Re: Get gchar* from Glib::ustring
- From: Daniel Elstner <daniel kitta googlemail com>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: Hubert Figuiere <hub figuiere net>, gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Get gchar* from Glib::ustring
- Date: Wed, 03 Jun 2009 23:53:09 +0200
Am Mittwoch, den 03.06.2009, 22:18 +0100 schrieb Chris Vine:
> And note that because the argument is untyped (it is an elipsis
> argument) you cannot use the normal C++ 0 as a synonym for NULL.
Note that in a C++ context, NULL is usually
#define NULL 0
or
#define NULL 0L
The latter works on most 64 bit machines as a varargs sentinel, but only
by accident. It is not guaranteed by the C or C++ standard.
> You must either use NULL explicitly or, if you want something more C++
> like, cast to void* with static_cast<void*>(0). Otherwise on 64 bit
> systems the 0 will be treated as a 32 bit integer rather than a 64 bit
> pointer.
An explicit cast of 0 to pointer type is in fact the only safe way.
--Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]