www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/01/05:32:49

From: "Carlos Giani_AEN2003 (M2003)" <DARKVALE AT pcc DOT tgm DOT ac DOT at>
Organization: TGM / PCC
To: djgpp AT delorie DOT com
Date: Mon, 1 Mar 1999 11:32:52 MET-1MDT
Subject: Re: BUG
X-mailer: Pegasus Mail v3.22
Message-ID: <4531617AFB@pcc.tgm.ac.at>
Reply-To: djgpp AT delorie DOT com

> Date sent:      Mon, 1 Mar 1999 11:47:19 +0200 (IST)
> From:           Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
> To:             "Carlos Giani_AEN2003 (M2003)" <DARKVALE AT pcc DOT tgm DOT ac DOT at>
> Copies to:      djgpp AT delorie DOT com
> Subject:        Re: BUG

> 
> On Mon, 1 Mar 1999, Carlos Giani_AEN2003 (M2003) wrote:
> 
> > Well, if you rewrite the above:
> >   y= (x) ? 1 : 2
> > 
> > y will ALWAYS be 1, and NEVER 2. You have to correct it to:
> > 
> >  y= (x!=0) ? 1 : 2
> 
> I cannot reproduce this bug.  Could you please post a *complete* program 
> that can be compiled and which exhibits this problem?  Also, please tell 
> what version of the compiler are you using ("gcc --version" will print 
> it), and what command line you used to compile the program.
> 

Here's an example program:

#include <stdio.h>
#include <conio.h>

int main(void)
{
  int x;
  int y;
  
  x = 0;
  
  y = (x) ? 1 : 2;  /* y will ALWAYS be 1 (this is the BUG!) */
  
  printf("%i\n",y);
  
  getch();
}

I use RHIDE and GCC 2.8.1


+-----------------------------------------------------+
| Carlos Giani_AEN2003, PC-Club (M2003)               |
| TGM - Schule der Technik, Abteilung Elektronik      |
|                                                     |
| During holidays or weekends use this email-address: |
| darkvale AT fcmail DOT com                                 |
+-----------------------------------------------------+

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019