Re: u/int64 support for glib, status?



On Wed, 19 Sep 2001 vishnu pobox com wrote:

> This is off-topic.  If you want types with exact bit-widths then you
> can write autoconf macros.
>
> What we are discussing is whether glib can accomodate five types of
> integers instead of four: char, short, int, long, *and* llong.

Then why does glib make such a point of creating gint8, gint16, etc.?  In
fact, this is a good comparison.  There exist the smaller types because
they represent values of those sizes, for struct packing and other
reasons.  There's also gint, which is presumably the standard 'int', which
should be the width of the machine (either 32 or 64 these days).  These
exist and are used just because they are register-sized, and thus are
presumed to be optimal for the current machine, with the addition of the
range values to handle whatever range they require.  The size is unknown,
but it doesn't matter as long as it's "big enough", because these things
are never going to be used in a size-critical manner, such as struct
packing.

Here's my idea: we start with the assumption that this isn't gonna be
running on anything less than 32 bits (is that true?), and that people
will in general be using INT for their GValues.  They can assume it's 32
bits or more.  For those people that actually need specific widths, which
means 64 bits or more (since we assume int is minimum 32 bits), we provide
types that guarantee a minimum bit size, i.e. 64.

This follows the usage that the gint types (do/should?) get: where it
matters, the specific widths are used.  There are two places: struct
packing (which is not GValue's purpose, so it's not relevant) on the small
end, and bignums on the large end (definitely within GValue's scope).
Everyone else just uses gint, which is the optimal size for the machine,
being register-sized.

That makes me wonder what the reason is then for both INT and LONG
GValues, since they're the same on all the archs I know of.  Another
potential discrepancy is the lack of WCHAR, now that I look at the list
more closely...

      Erik Walthinsen <omega temple-baptist com> - System Administrator
        __
       /  \                GStreamer - The only way to stream!
      |    | M E G A        ***** http://gstreamer.net/ *****
      _\  /_





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