Re: RFC: booleans and the kernel

From: Nix N. Nix (nix@go-nix.ca)
Date: Tue Jan 29 2002 - 01:36:47 EST


On Fri, 2002-01-25 at 06:28, Thomas Hood wrote:
> Jeff Garzik wrote:
> > A small issue...
>
> ... bound therefore to generate the most discussion ...
>

:o)

Since we /are/ gorging ourselves in this C-reverie, I might as well:
...
> > int x=0;
> >
> > if ( x = 1 )

In my first-year C programming course, one of my more seasoned (and
phlegmatic) professors recommended that we get used to using

if (1 == x)

instead of

if (x == 1)

so that, in case we /do/ miss the second '=', creating
(1 = x)
the compiler will puzzle over what exactly we mean by that and ask as
for advice in the form of something like "Error: lvalue required" (or
some such), an error, in any case.

Just comes to mind.
...
>
> MfG Kai
> -
> 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/
>

-
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/



This archive was generated by hypermail 2b29 : Thu Jan 31 2002 - 21:00:57 EST