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 possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 ownM_ARCH.(You can check all of the existing preprocessor definitions by using
gcc -dM -E foo.c > defines.)