Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-06-14 06:15:03


>stating that "Using a 0 where you should use NULL generates a 32-bit
constant. On Alpha systems, this could yield 0 in the low 32 bits and
useless data in the high 32 bits when passed into a function that
accepts a variable number of arguments. Using NULL from the <stdio.h>
header file provides the correct value. "

In 32bit everything works out fine whereas it does not when sizeof(T*)
!= sizeof(int)
<

Not true, using 0 rather than NULL only fails if you pass 0 to a function
with a variable argument list:

void foo(...);

int main()
{
foo(0); // this is not safe if you're expecting a void* in foo
foo(0L); // this is OK but platform specific
foo((void*)0); // this is OK and portable
}

IMO this is quite a rair situation and is more likely to effect C that C++
code. It is also a situation that boost::null can not fix (as far as I can
see).

- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk