可以使用 pragma warning disable 来禁止警报。要启用警报显示,请使用 pragma warning restore。
{warning disable <compiler ID>}
编译器 Id:编译器检测到的每个警报和每个错误都具有一个唯一 Id,其显示在描述的开头。
------ Build started: Application: Device.Application ------
typify code ...
C0196: 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
在此示例中,将为 test2 检测到一个警报。但是,将不会为 test1 检测到警报。