Re: [gtk-list] Re: More about types...



Havoc Pennington wrote:
> 
> On Sat, 6 Mar 1999, Drazen Kacar wrote:
> > How am I supposed to print size_t or off_t type of variable with g_print?
> 
> The same way you would with printf(), see Kernighan and Ritchie or man
> printf.

Neither of them helps a lot, but with printf it would be something
like this:

off_t offset;

#ifdef OFF_T_IS_32_BITS_LONG
printf("Offset: " PRIu32 "\n", offset);
#else
printf("Offset: " PRIu64 "\n", offset);
#endif

The problem is that I could be in 32 bit environment where off_t is 32
bits, or I could be in 64-bit environment where off_t is 64 bits, or
I could be in 32 bit environment with large files support where off_t is
64 bits, too.

Since GTK has all those gints, gpointers and such, it would be really
nice if there was gsize_t, goff_t & co. which would eliminate the
need for #ifdefs and different macros.

So, is there something like that? If not, which gtype is guaranteed to
hold size_t and off_t without losing precision?

-- 
 .-.   .-.    Life is a sexually transmitted disease.
(_  \ /  _)
     |        dave@srce.hr
     |        dave@fly.cc.fer.hr



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