sizeof(guint64)



Hi, I'm compiling on a 64-bit machine the following piece of code:


***
#include <glib.h>

int main(void)
{
    printf("GLIB version = %d_%d_%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);

    printf("Size of guint64   = %d\n", sizeof(guint64));
    printf("Size of long long = %d\n", sizeof(long long));

    return 0;
}
***

And what I get depends on whether I use the "-m32" gcc flag or not:

Case 1:

# gcc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  test.c
# ./a.out
GLIB version = 2_12_3
Size of guint64   = 8
Size of long long = 8


Case 2:

# gcc -m32 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  test.c 
# ./a.out
GLIB version = 2_12_3
Size of guint64   = 4
Size of long long = 8


Is this the expected behaviour?
I thought "guint64" had to be 8 bytes long no matter what!

I might also be the incredibly old GLIB version I'm using, though :)

Thanks.


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