Re: double exclamation (!!) suckage in the kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 26, 2007 at 06:38:07PM +0200, Bodo Eggert wrote:
> Not exactly, if(foo) is the same as if( (int) foo), which is not
> guaranteed to result in non-null values for non-null pointers.

RTFStandard.

> ISO 9899/1999 says: "Any pointer may be converted to an integer type. [...]
>          The result need not be in the range of values of any integer type."

... and it sure as hell does *NOT* say that controlling expression of
if statement is converted to an integer type.  For pointers of for anything
else.  if (v) is the same as if (v != 0) [6.8.4.1p2], and if v is a pointer,
0 in that comparison becomes a null pointer constant [6.5.9p5].
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux