Search code examples
delphidelphi-10.2-tokyo

How to get compiler version symbol


Except for constants RTLVersion and CompilerVersion is there any way how to get version symbol like VER320 instead of following code?

'VER' + IntToStr(Trunc(CompilerVersion * 10))

Solution

  • The simple answer to the question is no. There is no mechanism for code to enumerate conditional symbols.

    Your current approach is probably the best you can do, subject to there being no guarantee that future release of the compiler will follow the current VERxxx convention.

    Of course, you may as well simply report the compiler version directly.