检测用C编写的64位 [英] Detecting 64bit compile in C
本文介绍了检测用C编写的64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个C宏或某种方式,我可以检查我的C程序被编译在C 64位或32位在编译时?
is there a C macro or some kind of way that i can check if my c program was compiled as 64bit or 32bit at compile time in C?
编译器:GCC
那我需要做的检查操作系统:Unix / Linux操作系统
Compiler: GCC Operating systems that i need to do the checks on: Unix/Linux
还运行我的程序时,如果操作系统能够64位的我怎么能检查?
Also how could i check when running my program if the OS is capable of 64bit?
推荐答案
既然你标记这个海湾合作委员会,试图
Since you tagged this "gcc", try
#if __x86_64__
/* 64-bit */
#endif
这篇关于检测用C编写的64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文