Re: RFC: booleans and the kernel

Timothy Covell
2002-01-24T23:10:43Z

On Thursday 24 January 2002 16:59, Robert Love wrote:
> On Fri, 2002-01-25 at 17:47, Timothy Covell wrote:
> > > 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.
>
> Hm, I recall seeing something like:
>
> warning: suggest parentheses around assignment used as truth value
>
> from gcc ... yep, I still do.
>
> Robert Love
>
My mistake, I was looking at the ouput of my "char x;" example,
which IMHO is even worse.

covell@xxxxxxx ~>cat foo.c

#include <stdio.h>

int main()
{
char x;

if ( x )
{
printf ("\n We got here\n");
}
else
{
// We never get here
printf ("\n We never got here\n");
}
exit (0);
}
covell@xxxxxx ~>gcc -Wall foo.c
foo.c: In function `main':
foo.c:17: warning: implicit declaration of function `exit'

--
timothy.covell@ashavan.org.