How can I dependably identify the C++ compiler in each new release?
Every compiler predefines some macros that identify it. Compiler vendors tend to keep these predefined macros stable from release to release, and we in particular document them as a stable public interface. A good way to find out what compiler you have is to write a small program that tests for predefined macros and outputs a string suitable for your intended use. You can also write a pseudo-program and compile it with -E (or the equivalent for other compilers). See ‘macros’ in the index of the C++ User’s Guide for a list of predefined C++ compiler macros. In particular, the value of __SUNPRO_CC, which is a three-digit hex number. The first digit is the major release. The second digit is the minor release. The third digit is the micro release. For example, C++ 5.9 is 0x590.
Related Questions
- I get an error when downloading the release version of the Macintosh software in StuffIt format. Why would I get an error if I had no trouble with the demo version download?
- If I’ve been installing and using the JAWS public beta releases, should I remove the public beta before installing the official JAWS 9.0 release?
- How can I dependably identify the C++ compiler in each new release?