Re: 64bit format strings



On 1/10/06, Stefan Westerfeld <stefan space twc de> wrote:

>
> So the only remaining question is: does glib-2.x provide a guarantee
> that gint64 (and similar types) work together with PRId64 (and similar
> macros)? Then using PRId64 is a reasonable way to go.
>
> Let me explain the last thing:
>
> On a platform like Linux/AMD64 two integer types are 64bit integer
> types, namely long and long long. These require two different format
> strings, namely "%ld" and "%lld". Now a bad thing to do would be
>
>   typedef long int int64_t; /* <- <stdint.h> */
>   typedef long long gint64; /* <- glib-2.x */
>

From my reading of configure.in, we use the first integral type that
is 8 bytes long,
looking at int, long, long long. So if long and long long are both 64bit, we'll
pick long. Don't know if thats enough of a guarantee for you. It might
be worthwhile
pointing this little pitfall out on gnome-i18n gnome org, so that
translators can
watch out for things like this.

Matthias


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