#pragma 警告禁用代码列表及其含义
禁用警告的语法如下:
#pragma warning disable 414, 3021
或者,更一般地表达:
#pragma warning disable [CSV list of numeric codes]
是否有这些数字代码的列表以及它们正在抑制的警告的描述? 令我懊恼的是,我似乎无法通过谷歌找到它。
The syntax for disabling warnings is as follows:
#pragma warning disable 414, 3021
Or, expressed more generally:
#pragma warning disable [CSV list of numeric codes]
Is there a list of these numeric codes and the description of the warning that they're suppressing? Much to my chagrin, I can't seem to locate it via Google.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
MSDN 有一个警告代码列表。 不幸的是,您必须单击每个链接才能查看代码的实际含义。
MSDN has a list of warning codes. Unfortunately, you have to click each link to view what the code actually means.
你不应该需要一个清单。 编译器会告诉你。 如果您收到显示“警告 CS0168”的编译器错误,请将 168 添加到列表中(或者更好的是,修复代码)。
You shouldn't need a list. The compiler will tell you. If you get a compiler error that says "warning CS0168", then add 168 to the list (or, better yet, fix the code).
查看C# 编译器错误和警告列表以查找各个警告数字。
Look down the list of C# compiler errors and warnings to find the individual warning numbers.
仅供参考 -
如果您使用的是 Visual Studio 2008,您可以通过右键单击错误并从上下文中选择显示错误帮助来直接从错误列表获取代码菜单。 应该会弹出“帮助”窗口,并在 MSDN 网站上向您显示您想了解的有关该错误的所有信息。
可以节省你一点时间。
FYI -
If you're using Visual Studio 2008, you can get the code directly from the Error List by right-clicking the error, and selecting Show Error Help from the context menu. The Help window should pop up, and show you everything you ever wanted to know about the error a la the MSDN website.
Could save you a bit of time.
并非所有编译器都会显示该数字!
例如:
https://bytes.com/topic/c/answers/503957-function- void
没有显示任何警告数字,可以让我填写 ‵#param warning disable‵ 参数
因此,此列表对于其他编译器是必要的
NOT All Compiler will show the number!
for example:
https://bytes.com/topic/c/answers/503957-function-void
There are NO warning NUMBERS shown that would allow me to fill in the ‵#param warning disable‵ parameter
So, this list is necessary for other compilers