lkml.org 
[lkml]   [2002]   [Jan]   [24]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
SubjectRe: RFC: booleans and the kernel
FromXavier Bestel <>
Date24 Jan 2002 23:33:40 +0100
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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:18    [from the cache]
©2003-2008