Is there a way (for example, certain constants) for accessing the compilation flags with which the compiler was launched inside the compiled code.
For example, I need a program that records the flags with which it was compiled.
int main(){ std::cout << COMPILE_FLAGS << std::endl; }
Are there such constants for gcc / g ++? Or even better: Are there constants that are defined in both gcc and clang?
I am particularly interested in exploring the level of optimization and the meaning of the -march
flag. So, if there are no constants displaying all flags, are there at least those that display these values?
source share