基于 Delphi 2009 中的编译器指令的条件编译

发布于 2024-07-24 06:08:16 字数 162 浏览 1 评论 0原文

Delphi 2009 中是否有一种方法可以根据编译器指令有条件地编译一段代码。 具体来说,我希望只有在打开范围检查编译器指令时才包含代码。

像这样的东西:

{$ifdef RANGECHECKINGISON} [在此处执行范围检查代码] {$endif}

Is there a way in Delphi 2009 to have a section of code conditionally compiled based on a compiler directive. Specifically, I'd like to have code in place that is only included if the range-check compiler directive is turned on.

Something like this:

{$ifdef RANGECHECKINGISON}
[do range checking code here]
{$endif}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请恋爱 2024-07-31 06:08:17

使用 {$ifopt} 代替 {$ifdef}

{$ifopt R+} // if range checking is active
...
{$endif}

Use {$ifopt} instead of {$ifdef}:

{$ifopt R+} // if range checking is active
...
{$endif}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文