It is sometimes useful to write code for a specific version (or set of versions) of the tools.
For example to use new language constructs supported by a new version of the compiler.
How can that be accomplished?
Is there a way to determine the tools version in the sourcec
-
- Experienced Member
- Posts: 66
- Joined: Fri Feb 05, 2010 12:34 pm
-
- Experienced Member
- Posts: 66
- Joined: Fri Feb 05, 2010 12:34 pm
There is a #define XCC_VERSION_MAJOR to support writing code for a specific version (or set of versions) of the development tools.
The #define specifies the tool version and is passed automatically to all source files during compilation.
The format is AABB where AA is the major tools version and BB is the minor version.
E.g. for tools 12.2 the value of XCC_VERSION_MAJOR would be 1202.
Examples:
The #define specifies the tool version and is passed automatically to all source files during compilation.
The format is AABB where AA is the major tools version and BB is the minor version.
E.g. for tools 12.2 the value of XCC_VERSION_MAJOR would be 1202.
Examples:
Code: Select all
//If tools version 12 or later:#if XCC_VERSION_MAJOR >= 1200 // code specific to tools version 12 or later#endif //If any of the 11 tools#if (XCC_VERSION_MAJOR < 1200 && XCC_VERSION_MAJOR >= 1100) // code specific to any version 11.x.y#endif
-
- Experienced Member
- Posts: 66
- Joined: Fri Feb 05, 2010 12:34 pm
In addition, the minor tools version can also be useful.The minor tools version is the third number in the version. E.g. for tools version 13.0.2, the minor tools version is 2This is the preprocessor directive to activate code if the tools version is 13.0.2 or later:#if (XCC_VERSION_MAJOR >= 1300 && XCC_VERSION_MINOR >= 2)