On Thu, Feb 14, 2002 at 10:11:58AM -0500, Paul Davis wrote:
> >It is always better to use macros for portability reasons. A single #define
> this is nonsense. there has only ever been one meaning of a null
> pointer. the fact that certain projects have mis-defined it from the
> perspective of a C++ programmer doesn't change that.

"There has only ever been one meaning of a null pointer on known sensible
 systems."

Just like, one should be able to assume that "p++" and "--p" should
always work, although very strictly one cannot. The following code:

    char s[100];
    char *p = &s[-2];

    p[2];

May not actually work on some systems. Why? Because C only guarantees that
s[-1] will work.

I've never stumbled on one of these machines, but I suspect these
limitations may apply to systems without a real OS underneath them,
such as the Palm Pilot.

The C/C++ standards define NULL such that the onus is left to the
implementation to define NULL as something that "works".

Therefore, unless you plan on stating that "our tools only work on
'sensible' systems", for your own definition of sensible, "NULL" actually
is more portable than "0". (perhaps not by very much at all... but is it
really worth fighting over?)

mark

-- 
[EMAIL PROTECTED][EMAIL PROTECTED][EMAIL PROTECTED] __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/

_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to