5

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

Dumbo
  • 1,566

2 Answers2

11

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 -
Stephen Kitt
  • 434,908
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.

TNW
  • 2,110