Re: [gtk-list] Re: Gtk and C++ ?



On Tue, 19 Oct 1999 Valdis.Kletnieks@vt.edu wrote:

> On Tue, 19 Oct 1999 15:35:10 EDT, Owen Taylor <otaylor@redhat.com>  said:
> > #define NULL 0
> > #include <gtk/gtk.h>
> 
> Just remember that this may cause other problems elsewhere - ANSI also
> specifies NULL as a (void *) 0 if I remember right..  If you make this change,
> you'll know about it at compile time - if it compiles you're OK.  It will
> only bite you if you try to pass that zero to something that REALLY wants
> a 'void *'...

yes, in the glib 1.3 branch we actually have:

/* Provide definitions for some commonly used macros.
 *  Some of them are only provided if they haven't already
 *  been defined. It is assumed that if they are already
 *  defined then the current definition is correct.
 */
#ifndef NULL
#  ifdef __cplusplus
#    define NULL        (0L)
#  else /* !__cplusplus */
#    define NULL        ((void*) 0)
#  endif /* !__cplusplus */
#endif


the *real* problem actually is that gcc 2.95 doesn't warn about
(void*)0 usage with C++ (like 2.7.2 did) but actually errors out.

> -- 
> 				Valdis Kletnieks
> 				Computer Systems Senior Engineer
> 				Virginia Tech

---
ciaoTJ



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