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?
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?
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
.)