Delphi的$ WARN编译器指令的标识符 [英] Identifiers for Delphi's $WARN compiler directive

查看:386
本文介绍了Delphi的$ WARN编译器指令的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Delphi有一个$ WARN编译器指令,允许有选择地启用或禁用特定的警告。 Delphi 2009帮助文件描述了以下语法:

Delphi has a $WARN compiler directive that allows one to selectively enable or disable specific warnings. The Delphi 2009 help file describes the syntax:

{$WARN identifier ON|OFF}

但它只列出了6个警告的标识符。

But it only lists the identifiers for 6 warnings.

我想具有所有警告标识符的完整列表。特别是,我想知道Delphi 2009中隐式字符串转换警告W1057和W1058的标识符。

I'd like to have a complete list of all the warning identifiers. In particular, I want to know the identifiers for the implicit string cast warnings W1057 and W1058 in Delphi 2009.

我设法猜测一个隐式的Ansi-> Unicode转换(W1057):

I managed to guess the one for implicit Ansi->Unicode casts (W1057):

{$WARN IMPLICIT_STRING_CAST OFF}

Googling为我找到另一个:

Googling for that found me the other one:

{$WARN IMPLICIT_STRING_CAST_LOSS OFF}

尽管解决了我的迫切需要,我仍然想知道完整的警告列表身份标识。这样的东西应该记录在案。

Though that solves my immediate need, I'd still like to know the complete list of warning identifiers. Stuff like this should be documented.

推荐答案

我看过帮助,没有看到完整的列表...所以戳在代码周围,编译器警告常量都列在:
CodeGear\RAD Studio\6.0\sources\toolsapi\DCCStrs.pas

I looked through the help and didn't see a full list...so poking around the code it appears the compiler warning constants are all listed in: CodeGear\RAD Studio\6.0\sources\toolsapi\DCCStrs.pas

搜索Implicit_String_Cast_Loss,您将看到常量
sIMPLICIT_STRING_CAST_LOSS ='DCC_IMPLICIT_STRING_CAST_LOSS';

Search for "Implicit_String_Cast_Loss" and you'll see the constant sIMPLICIT_STRING_CAST_LOSS = 'DCC_IMPLICIT_STRING_CAST_LOSS';

我将假设其余的DCC_xxx字符串具有相应的X_true / _false / _error定义是你以后的。

I would assume the rest of the DCC_xxx strings with corresponding X_true/_false/_error defines are what you are after.

从Delphi 7开始,在线帮助并不是很好。

Online help hasn't been very good since Delphi 7.

这篇关于Delphi的$ WARN编译器指令的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆