[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070526165009.GT4095@ftp.linux.org.uk>
Date: Sat, 26 May 2007 17:50:09 +0100
From: Al Viro <viro@....linux.org.uk>
To: Bodo Eggert <7eggert@....de>
Cc: Jan Engelhardt <jengelh@...ux01.gwdg.de>,
David Miller <davem@...emloft.net>, satyam.sharma@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: double exclamation (!!) suckage in the kernel
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists