Re: RFC: booleans and the kernel

Xavier Bestel
2002-01-24T22:54:53Z

le ven 25-01-2002 à 23:47, Timothy Covell a écrit :
> On Thursday 24 January 2002 16:33, Xavier Bestel wrote:
> > le ven 25-01-2002 à 22:24, Timothy Covell a écrit :
> > > On Thursday 24 January 2002 14:39, Oliver Xymoron wrote:
> > > > The compiler _will_ turn if(a==0) into a test of a with itself rather
> > > > than a comparison against a constant. Since PDP days, no doubt.
> > >
> > > I thought that the whole point of booleans was to stop silly errors
> > > like
> > >
> > > if ( x = 1 )
> > > {
> > > printf ("\nX is true\n");
> > > }
> > > else
> > > {
> > > // we never get here...
> > > }
> >
> > gcc already warns you about such errors.
> >
> > Xav
>
> That's funny, I compiled it with "gcc -Wall foo.c" and got no
> warnings. Please show me what I'm doing wrong and how
> it's _my_ mistake and not the compilers.

[xav@bip:~]$ gcc -Wall a.c
a.c: In function `main':
a.c:8: warning: suggest parentheses around assignment used as truth value

Xav