On Sat, 14 Oct 2000, Allan Rae wrote:

> On 13 Oct 2000, Jean-Marc Lasgouttes wrote:
> 
> > >>>>> "Marko" == Marko Vendelin <[EMAIL PROTECTED]> writes:
> > 
> > >> Marko is there any particular reason for using NULL instead of 0 in
> > >> a lot of your code? Is this a gnome convention? Where is it
> > >> defined?
> > 
> > Marko> I am just used to call NULL a pointer that might lead to a core
> > Marko> dump. I haven't looked into gnome conventions recently, but if
> > Marko> you will give me a good reason to use integer 0 insted of NULL
> > Marko> then I can change everywhere NULL to this particular integer
> > Marko> value.
> > 
> > I could not find a reference to it anywhere, but I am sure Lars will
> > be able to remind us why NULL is evil :)
> 
> I'll supply one:  NULL is a C'ism while 0 is C++.
> 
> That's why I asked where NULL is defined.  I suspect you are getting NULL
> from a C header file where it is probably defined as (void*)0 or something
> similar -- if you write 0 the C++ compiler will consider it to be
> static_cast<WhateverType *>(0) and the 0 will therefore have an
> _appropriate_ type.
> 
> If you were being tricky and setting all your dynamic memory to 0x0a or
> some other marker to help detect uninitialised memory I could understand
> you using something other than 0 to initialise a pointer (provided the
> rest of your code was full of Assert()'s checking the pointers against
> that value).  In C++ if you mean zero you write 0.  IIRC, this is
> mentioned in both the C++ FAQ and Effective C++.

I see. I'll submit a patch as soon as I'll be back in my office (in a week
or so).

Marko

Reply via email to