Re: Get gchar* from Glib::ustring



On Wed, 3 Jun 2009 15:37:53 -0300
Fabrício Godoy <skarllot gmail com> wrote:
> 2009/6/3 Hubert Figuiere <hub figuiere net>
> > On 06/03/2009 02:08 PM, Fabrício Godoy wrote:
> >>     path = g_build_filename(ustr1.c_str(), ustr2.c_str(),
> >> ustr3.c_str());
> >>
> >>
> > Because, as written in the Fine Manual, you must end the argument
> > list with NULL.
> 
> I can't believe, I missed this o my copies and pastes.
> Sorry and thanks.

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.

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.

Chris



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