Re: GLib 64 bit integer problem revisited
- From: Tim Janik <timj gtk org>
- To: jcf tpg com au
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: GLib 64 bit integer problem revisited
- Date: Mon, 18 Nov 2002 23:57:56 +0100 (CET)
On Mon, 18 Nov 2002, Owen Taylor wrote:
> Thse machines have 64-bit longs, not 64-bit ints.
>
> The problem you are running into is that gint64 and 'long int' ae
> the same.
>
> I'm not really sure that there is much you can do here .. you'll
> probably just have to punt the issue and go with:
>
> Inti::G::Value::get64 (gint64 &)
> Inti::G::Value::set64 (gint64)
>
> The problem is that the C++ equivalent of:
>
> g_value_set_int64 (value, num);
>
> Needs to leave the value with a type of G_TYPE_INT64, so it has
> to be distinct from the C++ equivalent of g_value_set_long (value, num);
>
> In hindsight, having both int/long and int64 for GValue is probably
> a bad idea; it probably would have been better to just have int32
> and int64... but not something we can change at this point.
right, using longs as properties or signal arguments is a bad idea anyways,
so language bindings like C++ should simply use set/get (gint&) and (gint64&)
and skip longs entirely (internally, these may be passed on as TYPE_INT or
TYPE_INT64 values to g_object_set_property(), the property system performs
the necessary conversions if required).
that is, unless there're compat reasons set/get (glong&) have to stay in the
C++ bindings.
>
> Regards,
> Owen
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]