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



Hi,

> Summary:
> GTK has an poor/incorrect definition of NULL that breaks C++ code.  At a
> minimum, the definition should be fixed.  However, the better fix would be
> to simply remove the definition, and use the one provided by the compiler.

here's how glib-2.0 defines NULL:

  /* We include stddef.h to get the system's definition of NULL
   */
  #include <stddef.h>

  #ifndef NULL
  #  ifdef __cplusplus
  #    define NULL        (0L)
  #  else /* !__cplusplus */
  #    define NULL        ((void*) 0)
  #  endif /* !__cplusplus */
  #endif

this looks much better, doesn't it? BTW, glib-1.2 does not redefine NULL
neither:

  #ifndef NULL
  #define NULL    ((void*) 0)
  #endif

so if you run into problems because of this definition, you should
probably define NULL before you include glib.h (or even include an
appropriate header that defines NULL more correctly).


Salut, Sven



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