Special Hot Alien ?! ;-)

check gcc compile -m64, -m32

20 Jul 2016

sample code:

#include <stdio.h>

void main()
{
    unsigned long p;

    printf("%p\n", &p);

// 64bit compile check. -m64, -m32
//
#if __LP64__
    printf("__LP64__ defined...\n");
#else
    printf("__LP64__ not defined...\n");
#endif

    printf("p's sizeof is %zu\n", sizeof(p));
}

Note: gcc only.

output:

$ gcc -o bitmode_compile bitmode_compile.c -m64 && ./bitmode_compile
0x7ffe5fe59380
__LP64__ defined...
p's sizeof is 8

$ gcc -o bitmode_compile bitmode_compile.c -m32 && ./bitmode_compile
0xffbf1fb8
__LP64__ not defined...
p's sizeof is 4

original source: http://kaspyx.kr/78

Tweet
comments powered by Disqus