Re: ?? warning: ANSI C++ forbids implicit conversion from `void *' in initialization ???



From: Chris Seberino <seberino spawar navy mil>
>
> Paul
>
> I may sometimes give impression I'm smart but looks can
> be deceiving. :) (Ph.D. in physics not computing)  
> I have ZERO X experience!
>
> I looked for NULL explanation about why "= NULL" bad
> but could not anything.  Can you give me a 1-2 sentence
> explanation? Is it a security risk somehow or something?

It's got something to do with the stronger typecasting
in C++, relative to C.

> By the way, someone should tell the GTK+ tutorial author
> that "= NULL" is bad since it has this in scribble.c and
> apparently he hasn't learned it either. :)

That's because it's C and not C++. NULL is completely appropriate in C.

> I'm glad I have input by all these great experts on this mailing list.
>
> Thanks for everything!
>
> Chris
>
> On Wed, Feb 06, 2002 at 02:22:48PM -0500, Paul Davis wrote:
> > >I need to sometimes initialize an object to NULL and get this
> > >message.  How avoid???
> > 
> > this is getting too close to generic programming questions for this
> > list. if you don't understand how to fix this yourself, i worry about
> > future progress on your software.
> > 
> >        SomeObject *someObject = (SomeObject *) 0;
> > 
> > you should never use "NULL" in a C++ program. look it up with google
> > to understand why.
> > 
> > --p



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]