在编译时检测到 >= Alexandria 11.3

huangapple go评论116阅读模式
英文:

Compile-Time detection of >= Alexandria 11.3

问题

我怎么(在编译时)检测到 Alexandria 11.2 和 11.3 之间的差异(或者更确切地说,如何检测您是否处于 11.3 或更高版本?)

两者的 CompilerVersion 和 RTLVersion 值都为 35。

英文:

How do you (compile-time) detect the difference between Alexandria 11.2 and 11.3 (or, rather, how do you detect you are at 11.3 or later?)

Both have CompilerVersion and RTLVersion value at 35.

答案1

得分: 6

有常量 RTLVersion111RTLVersion112RTLVersion113,根据编译的版本而声明。可以这样检测它们:

{$IF declared(RTLVersion113)}
  ...
{$IFEND}
英文:

There are constants RTLVersion111, RTLVersion112 and RTLVersion113 declared depending on the version you are compiling with. These can be detected like this:

{$IF declared(RTLVersion113)}
  ...
{$IFEND}

答案2

得分: 0

{$IF CompilerVersion > 35 }
{$DEFINE Alexandria3 }
{$ELSEIF CompilerVersion < 35 }
{$UNDEF Alexandria3 }
{$ELSEIF Declared(RTLVersion113) }
{$DEFINE Alexandria3 }
{$ELSE }
{$UNDEF Alexandria3 }
{$ENDIF }

现在你可以使用

{$IFDEF Alexandria3 }

来有条件地编译适用于Alexandria3或更高版本的代码。

英文:

Extended Answer, based on Uwe Raabe's answer:

{$IF CompilerVersion &gt; 35 }
  {$DEFINE Alexandria3 }
{$ELSEIF CompilerVersion &lt; 35 }
  {$UNDEF Alexandria3 }
{$ELSEIF Declared(RTLVersion113) }
  {$DEFINE Alexandria3 }
{$ELSE }
  {$UNDEF Alexandria3 }
{$ENDIF }

Now you can

{$IFDEF Alexandria3 }

to conditionally compile code for Alexandria3 or later.

huangapple
  • 本文由 发表于 2023年3月7日 17:16:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/75659998.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定