开发者

Can I printf g++'s architechture

开发者 https://www.devze.com 2022-12-20 00:14 出处:网络
I\'d like to do something similar to this in g++: printf(\"Architecture: %s\", M_ARCH); but I don\'t know how or if it\'s even pos开发者_开发百科sible?No, there doesn\'t appear to be anything that

I'd like to do something similar to this in g++:

printf("Architecture: %s", M_ARCH);

but I don't know how or if it's even pos开发者_开发百科sible?


No, there doesn't appear to be anything that easy.

Specific architectures are defined such as __amd64__ and __i386__, but you would have to write your own macro to check #ifdef __amd64__ etc to define your own M_ARCH.

(You can check all of the existing preprocessor definitions by using gcc -dM -E foo.c > defines.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号