Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-06-04 06:30:12


--- Michal 'Sektor' Malecki <michalmal_at_[hidden]> wrote:
> Please, pay attention, because I am totally out of time.
> Little description:
>
[...]
>
> c) null
> In C++ you should not use NULL, because it's missing. However C++
> would need
> some "universal null pointer" value. There is a very simple
> definition, thanks to which
> you have a "null" called symbol, you can assign it into ANY pointer
> value (if in some
> cases it would be impossible, you can use null.cast<TYPE>()), you can
> compare
> some pointer with it, you can pass this symbol as a function
> argument, if overloaded
> for a pointer and an integer, the pointer version is choosen.

Even though your implementation has some differences with Scott
Meyers's one, I think you absolutely *CANNOT* take credit for that NULL
template. (I'm not saying you did, but it's a bit weird that you
explain the int/pointer overloading stuff when you could have simply
made a reference to 'Effective C++')

 You can
> also provide another
> "null pointer value" implementation for some type (default is
> so-called NULL) by
> overdefining the empty_pointer_value::cast<Type>().

To do what? It's an implementation detail whether the null pointer
value of a given type is "all bits zero" or not. You can also have an
implementation where the null pointer value of type T1 has a different
bit pattern than the null pointer value of type T2 (T1 <> T2) but you
always use a compile time 0 (or any other null pointer constant, like
(1-1) ) to represent each of them. The compiler will take care to
translate the source code representation into the correct bit pattern.

Genny.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com


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