Is there a way to determine the tools version in the sourcec

If you have a simple question and just want an answer.
Post Reply
User avatar
Thomas
Experienced Member
Posts: 66
Joined: Fri Feb 05, 2010 12:34 pm

Is there a way to determine the tools version in the sourcec

Post by Thomas »

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?

 
 


User avatar
Thomas
Experienced Member
Posts: 66
Joined: Fri Feb 05, 2010 12:34 pm

Post by Thomas »

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:

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 
User avatar
Thomas
Experienced Member
Posts: 66
Joined: Fri Feb 05, 2010 12:34 pm

Post by Thomas »

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)
Post Reply