Re: What is the best way to default construct an object.



Havoc Pennington wrote:

Jeff Franks <jcf tpg com au> writes:
g_object_new(GType, 0);


You're supposed to use this one. (I'm not sure "0" works for a pointer
in if there's no pointer type in the prototype though - what if
sizeof(int) != sizeof(void*)? I'm not enough of a language lawyer to
actually know the answer to that though. ;-)

But the prototype is:
gpointer g_object_new (GType object_type, const gchar *first_property_name, ...);

So the 0 should get cast correctly to a pointer :)

James.

--
Email: james daa com au
WWW:   http://www.daa.com.au/~james/







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