Re: Get gchar* from Glib::ustring





2009/6/3 Daniel Elstner <daniel kitta googlemail com>
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.

Well, I'm somewhat confused. Should I use "static_cast<void*>(0)"?
Each item is not char (16 bit)?




--Daniel





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