问题
I was trying to use -dumpversion to determine if the compiler is usable. My project compiles with clang and newer gccs, but not with the old gcc 4.2.1.
So why does clang pretend to be an old gcc?
Extra questions, is it possible to change this value at runtime?
Or does anyone have a nice autoconf macro to determine the compiler version with both clang and gcc?
回答1:
Clang was originally written to be compatible with gcc 4.2.1. There has been some discussion about updating that number earlier this year, but there were issues.
For autoconf checking, clang suggests to use its __has_feature extension. Clang's document has a list of things you can check with __has_feature too.
来源:https://stackoverflow.com/questions/12893731/why-does-clang-dumpversion-report-4-2-1