RE: C++ gnome code vs. gcc-2.95.1
- From: James Henstridge <james daa com au>
- To: Marcin Gorycki <mgo olicom dk>
- cc: "'Havoc Pennington'" <hp redhat com>, "'gnome'" <gnome-list gnome org>, "'James Antill'" <james and org>
- Subject: RE: C++ gnome code vs. gcc-2.95.1
- Date: Wed, 6 Oct 1999 23:07:47 +0800 (WST)
It is glib that is defining NULL. Doing a cvs log on glib.h, we see that
the problem is fixed in the HEAD branch (revision 1.140):
Wed Sep 22 01:53:18 1999 Tim Janik <timj@gtk.org>
* glib.h (NULL): define NULL as (0L) if __cplusplus is defined, to
avoid "ANSI C++ forbids implicit conversion from `void *' in argument
passing" errors upon NULL usage in C++ programs (gcc-2.95 is on crack
for erroring out on this, instead of just issueing a warning).
* glib.h (g_trash_stack_pop): use uncasted NULL again.
Maybe this patch should be merged in from the head branch.
James.
--
Email: james@daa.com.au
WWW: http://www.daa.com.au/~james/
On Wed, 6 Oct 1999, Marcin Gorycki wrote:
> > On Wed, 6 Oct 1999, Marcin Gorycki wrote:
> > > > Hmm... Can you #undef NULL where you use these macros and
> > > > define NULL as above?
> > >
> > > sure I can, but should I be forced to do it ? Shouldn't the macros
> > > themselves be fixed ?
> > >
> >
> > I don't think 0 is correct in C; that is the problem. Using 0
> > for the NULL
> > pointer may cause "implicit conversion from integer to
> > pointer" warnings.
>
> solution:
>
> #ifdef __cplusplus
> #undef NULL
> #define NULL 0
> #endif
>
> marcin
>
>
> --
> FAQ: Frequently-Asked Questions at http://www.gnome.org/gnomefaq
> To unsubscribe: mail gnome-list-request@gnome.org with
> "unsubscribe" as the Subject.
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]