【问题标题】:Conditional compilation based on a compiler directive in Delphi 2009基于 Delphi 2009 中的编译器指令的条件编译
【发布时间】:2009-06-05 18:53:59
【问题描述】:

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

类似这样的:

{$ifdef RANGECHECKINGISON} [在这里做范围检查代码] {$endif}

【问题讨论】:

    标签: delphi compiler-construction delphi-2009 conditional directive


    【解决方案1】:

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

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

    【讨论】:

    • 很遗憾你不能说“{$IFOPT RANGECHECKS ON}”。 :-/
    猜你喜欢
    • 2020-07-02
    • 2011-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多