属性:warning disable, warning restore
这 warning disable
属性具有抑制特定警告的效果。这 warning restore
pragma 重新激活被抑制的消息。
此属性可用于每个编译器警告。您可以在 CODESYS Development System 在项目的项目设置中(项目 → 项目设置, 编译器警告 类别)。
句法:
{warning disable <compiler ID>}
{warning restore <compiler ID>}
<compiler ID>
: 位于错误或警告消息开头的 ID。
例 292. 例子
编译器消息:
typify code ... C0195: Implicit conversion from unsigned Type 'UINT' to signed Type 'INT' : possible change of sign Compile complete -- 0 errors
将编译指示应用于变量声明:
VAR {warning disable C0195} test1 : UINT := -1; {warning restore C0195} test2 : UINT := -1; END_VAR
test1
不生成警告; test2
生成警告。