Re: 0 vs. NULL

2007-10-15 Thread Micah Cowan
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Paul Eggert wrote: > Bruno Haible <[EMAIL PROTECTED]> writes: > >> Compilers such as Sun C++ really define NULL to 0 >> (in both C and C++ mode!), and misinterpret NULL in varargs and sizeof. > > The problem with varargs is one that has bitten me p

Re: 0 vs. NULL

2007-10-15 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes: > Compilers such as Sun C++ really define NULL to 0 > (in both C and C++ mode!), and misinterpret NULL in varargs and sizeof. The problem with varargs is one that has bitten me personally. Ouch! But "sizeof (NULL)" is a new one on me. As near as I can m

Re: 0 vs. NULL

2007-10-13 Thread Bruno Haible
Micah Cowan wrote: > it is not safe to assume that using NULL, addresses those > argument-passing problems To be > portable, it must be cast when passed as a vararg param. Indeed! Good point. Compilers such as Sun C++ really define NULL to 0 (in both C and C++ mode!), and misinterpret NULL in

Re: 0 vs. NULL

2007-10-13 Thread Micah Cowan
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Bruno Haible wrote: > Ben Pfaff wrote: >> ISO C says that NULL can be defined as 0, without a cast to void >> *, and it is always defined that way in C++. > > The latter statement is not true. ISO C++ 18.1.(3) says: > > "The macro NULL is an impl

Re: 0 vs. NULL (was: Re: Test for getaddrinfo() broken on Tru64 UNIX 5.1)

2007-10-13 Thread Bruno Haible
Ben Pfaff wrote: > ISO C says that NULL can be defined as 0, without a cast to void > *, and it is always defined that way in C++. The latter statement is not true. ISO C++ 18.1.(3) says: "The macro NULL is an implementation-defined C++ null pointer constant in this International Standard (4

Re: 0 vs. NULL (was: Test for getaddrinfo() broken on Tru64 UNIX 5.1)

2007-10-13 Thread Bruno Haible
Benoit SIGOURE wrote: > In C++, `0' is the preferred way of expressing `NULL'. In C++, 0 can be used instead of NULL everywhere except inside sizeof and varargs argument lists. But what is _preferred_, depends on your and your co-developers' habits. People who also program in C prefer NULL becau