[lkml]   [2002]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: RFC: booleans and the kernel
On Sat, Jan 26, 2002 at 03:08:41AM +0000, Jamie Lokier wrote:

> Helge Hafting wrote:
> > Why would anyone want to write if (X==false) or if (X==true) ?
> > It is the "beginner's mistake" way of writing code. Then people learn,
> > and write if (X) or if (!X). Comparing to true/false is silly.
> > Nobody writes if ( (a==b) == true) so why do it in the simpler cases?
> I usually without the == in these cases:
> if (pointer) // test for non-0.

Huh? I thought we were talking about C here, // in C is an abomination, use /*
*/ :-)

> Just to break that rule, however, if p were a pointer and x were an
> integer, I would write:
> x = (p != 0);

Heard about NULL ?

> rather than
> x = p;

Because that would give a compile error...


Mark Zealey

UL++++>$ G!>(GCM/GCS/GS/GM) dpu? s:-@ a16! C++++>$ P++++>+++++$ L+++>+++++$
!E---? W+++>$ N- !o? !w--- O? !M? !V? !PS !PE--@ PGP+? r++ !t---?@ !X---?
!R- b+ !tv b+ DI+ D+? G+++ e>+++++ !h++* r!-- y--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:18    [W:0.048 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site