检测CPU架构编译时 [英] Detecting CPU architecture compile-time

查看:109
本文介绍了检测CPU架构编译时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是编译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 #ifdefs?

推荐答案

下面是关于 $ P的一些信息$ p-定义架构的宏和其他类型的pre定义的宏。

Here is some information about Pre-defined Architecture Macros and other types of pre-defined macros.

这篇关于检测CPU架构编译时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆