Re: G_TYPE_INT64



On Thu, 4 Oct 2001 vishnu pobox com wrote:

> 4) i tried to follow the pattern in gvaluecollector.h, but i really
> have no idea if i did it correctly.  i don't understand this code and
> i'm not sure how to test it.  There is related code in gvaluetypes.c
> with which i have the similar reservations.  At least it compiles
> cleanly.  :-/

i looked over what's now in CVS, and the value collection stuff you
added is correct (as is the other stuff, now that you fixed MAXINT64
etc. as owen requested).
the value collection interface can be tested (or is used with)
g_object_set/get, i.e. this should now work:

gint64 i64;

g_object_set (o, "int64_prop", (gint64) 545, NULL);
g_object_get (o, "int64_prop", &i64, NULL);
g_assert (i64 == 545);

note that failing to cast 545 into (gint64) will messup
the stack for g_obejct_set() on systems where sizeof(gint64)!=(sizeof(int),
and g_object_get() can, for the same reason, lead to a segfault if
something smaller in size like int v_int; is passed in.
however, people using int64 types in the varargs interface will
(have to) be aware of that. the trickier part is actually longs,
as g_object_set/g_object_get will work fine with int v_long; on
systems where sizeof(int)==sizeof(long) and fail only on 64bit
machines (suckage). thus, introducing properties of type long is
not really recommended.

thanks for completing the fundamental type implementation for gint64.


---
ciaoTJ





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