如何关闭对文件一部分的范围检查。关闭很容易,但稍后如何恢复到项目设置?下面的伪代码应该解释它:
Unit1;
//here's range checking on or off as per the project setting
code here...
{$R-}
//range checking is off here because the code causes range check errors
code here...
//now I want to revert to the project setting. How do I do that?
code here...
end.
最佳答案
参见:IFOPT directive .
{$IFOPT R+}
{$DEFINE RANGEON}
{$R-}
{$ELSE}
{$UNDEF RANGEON}
{$ENDIF}
//range checking is off here because the code causes range check errors
//code here...
{$IFDEF RANGEON}
{$R+}
{$UNDEF RANGEON}
{$ENDIF}
关于delphi - 仅关闭一小部分代码的 Delphi 范围检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4997911/