检测CPU架构编译时 [英] Detecting CPU architecture compile-time
问题描述
什么是编译C或C ++ code时,发现CPU架构的最可靠的方法是什么?据我所知,不同的编译器有自己的一套非标准preprocessor定义( _M_X86
在MSVS, __ 386 __
, __ __手臂
在GCC,等等)。
What is the most reliable way to find out CPU architecture when compiling C or C++ code? As far as I can tell, different compilers have their own set of non-standard preprocessor definitions (_M_X86
in MSVS, __i386__
, __arm__
in GCC, etc).
有没有的标准的方法来检测我建立的架构?如果没有,是否有对各种编译器这样的定义,如所有的样板 #IFDEF
个标题的COM prehensive名单的来源?
Is there a standard way to detect the architecture I'm building for? If not, is there a source for a comprehensive list of such definitions for various compilers, such as a header with all the boilerplate #ifdef
s?
推荐答案
下面是关于 $ P的一些信息$ p-定义架构的宏和其他类型的pre定义的宏。
Here is some information about Pre-defined Architecture Macros and other types of pre-defined macros.
这篇关于检测CPU架构编译时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!