Boost logo

Boost :

From: Iain.Hanson_at_[hidden]
Date: 2001-06-08 09:49:13


gregod (gregod_at_[hidden]) wrote

     snip ...
>Advantages of 'nil' over NULL:
> - NULL is not necessarily portable. Some C++ compilers pick up bad
>information to the user.

The problem is that there is no portable definition of nil. nil has been defined
by a bzillion different people to mean different things. Stroustrup's D & E
discusses the problems with this. CORBA has a nil, Czarnecki & Eisenecker have
a nil in the software from their book 'Generative Programming' and many other
class libraries have a nil. This seems like a bad idea IMHO.

>Advantages of 'nil' over 0:
> - 0 is an integer. It converts to pointer types but doesn't convey much
>information to the user.

Initially, when I was converting to C++ from C, I wanted to use NULL,NIL, ZERO
or any symbolic name. Once I read D & E I got very comfortable with the humble
0. It coveys more than enough information for me.
> - the type of 0 is "const int". Overloading a function to take a null va
>based on const int also allows any integer value to be passed in, and the
>error cannot be detected at compile-time.

Personally, I don't see much ( if any ) need to be able to overload
specifically on a null pointer over any other pointer.


Visit our website at

This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.

Boost list run by bdawes at, gregod at, cpdaniel at, john at