Date: Mon, 14 Jan 2013 01:11:35 -0500 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: NULL On Sun, Jan 13, 2013 at 01:46:28PM -0600, Rob Landley wrote: > On 01/13/2013 11:47:32 AM, Szabolcs Nagy wrote: > >> So I think you're saying is that the behavior I'm depending on > >changed? > > > >well, > > > >(int)(void*)0 is not an "integer constant expression" and it > >is not a "null pointer constant", > > C99 18.104.22.168: An integer constant expression with the value 0, or > such an expression cast to type void *, is called a null pointer > constant. > > 7.17 #3: The macros are NULL which expands to an > implementation-defined null pointer constant; > > So it uses "constant" in the name but either it's not a constant or > typecasting it twice makes it stop being a constant. Basically, the latter. It may still be a constant, but it's neither an integer constant expression (this is a very restricted category of expressions) not a null pointer constant. In any case, this thread has gotten WAY off-topic, going all over the place into territory about the merits and demerits of different languages and anti-FSF politics. Those topics may be worth discussing in some contexts, but it seems to have left everybody really confused about the issues at hand, which are: - whether we should work around broken programs that pass NULL to variadic functions - and if so, how The emerging consensus seems to be using #define NULL 0L unconditionally in both C and C++ mode. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.