Linux系统下程序如何区分是64位系统仍是32位系统 编码
通过对include的翻查,最后肯定gcc以__i386__来 进行32位编码,而以__x86_64__来进行64位编 码;64位的gentoo下stdio.h就是个简单例子(i不晓得其它的是否是?);并且在bits/wordsize.h中对这两个定义进行了综合, 以__WORDSIZE的值来表示机器类型,你们能够直接去看看 spa
例子 it
#include <stdio.h> io
int main(int argc ,char* argv) gcc
{ gc
#ifdef __x86_64__ 程序
printf("__x86_64__"); word
#elif __i386__ gentoo
printf("__i386__"); di
#endif
return 0;
}