4

I am wondering if there is a way to simply output to the terminal the value of some global/standard definitions of C/GCC, e.g. using the echo command, without writing C code and using printf?

I mean things like __GNUC_, __UINT64_MAX__, _POSIX_C_SOURCE ...

10

You can view the value of any defined constant as follows:

echo __GNUC__ | gcc -E -

If you need to add an include file:

echo O_APPEND | gcc -include fcntl.h -E -
2
gcc -E file.c

Will do what you want it to. It's a good idea to browse it's manual, as assembly output is possible as well, not to mention lots of other features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.