RE: ?? warning: ANSI C++ forbids implicit conversion from `void * ' in initialization ???
- From: Esteban Quijano <Esteban Quijano artinsoft com>
- To: gtk-list gnome org
- Subject: RE: ?? warning: ANSI C++ forbids implicit conversion from `void * ' in initialization ???
- Date: Wed, 13 Feb 2002 16:31:30 -0600
It is not true that NULL cannot be used in C++. I don't have to google
anything to understand basic things about stricter type casting. I have tons
of C++ lines of code running perfectly on Windows and Linux without any
trouble. NULL is just a macro you can define as you want in your project:
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
Esteban Quijano
QA dept.
Artinsoft corp.
> -----Original Message-----
> From: Chris Seberino [mailto:seberino spawar navy mil]
> Sent: Wednesday, February 13, 2002 3:37 PM
> To: Paul Davis
> Cc: gtk-list gnome org
> Subject: Re: ?? warning: ANSI C++ forbids implicit conversion
> from `void
> *' in initialization ???
>
>
> 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?
>
> 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. :)
>
> 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
>
> --
> =======================================================
> | Dr. Christian Seberino || (619) 553-7940 (office) |
> | SPAWARSYSCEN 2363 || (619) 553-2836 (fax) |
> | 53560 HULL ST || |
> | SAN DIEGO CA 92152-5001 || seberino spawar navy mil |
> =======================================================
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]