[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: NULL vs. 0 (was Re: PATCH: flicker in startup identification)
From:       Richard Moore <rich () ipso-facto ! freeserve ! co ! uk>
Date:       2001-05-18 14:29:32
[Download RAW message or body]



Harri Porten wrote:
> 
> On Fri, 18 May 2001, Guillaume Laurent wrote:
> 
> > On Friday 18 May 2001 14:44, Lubos Lunak wrote:
> >
> > >  Hmm. Such a long patch for a one-line change. Is there any serious reason
> > > why you want to replace all the NULL's with 0's ? It's the same.
> >
> > Not quite, according to Stroustrup use of NULL is discouraged, 0 is
> > preferred. I think it's because NULL is typed while '0' is "more flexible" or
> > something like that. I don't have my copy of TC++PL 3rd at hand.
> 
> If NULL is defined to (void*)0 or something like that it's certainly
> problematic as it specifies a type you may not want. I guess there might

Yes, and you must explicitly cast a void * pointer before you can
assign it to a non-void pointer according to the spec IIRC. This
would mean you'd need to write something like:

KDialog *createdOnDemand = (KDialog *) NULL;
instead of:
KDialog *createdOnDemand = 0;

Rich.

> be alignment issues in case you wanted a null pointer to a KHTMLPart for
> example.
> 
> Harri.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic