编译器警告(等级 1)C4179
“
//*
”:被分析为“/
”和“/*
”:与标准“//
”注释混淆
在标准 C89 中,//*
是错误的注释分隔符。 请改用 /Za
下的 /*
。
备注
在 Visual Studio 2017 版本 15.5 之前,在 /Za
下,C 编译器会针对非标准注释分隔符发出 C4179。
在 Visual Studio 2017 版本 15.5 中,C 编译器不再发出警告 C4001 和 C4179。 不需要这些警告是因为自 C99 以来单行注释已成为 C 标准的一部分。
/* C only */
#pragma warning(disable:4001) // C4619
#pragma warning(disable:4179)
// single line comment
//* also a single line comment */ // Caused C4179
warning C4619: #pragma warning: there is no warning number '4001'
如果代码不需要向后兼容,可以通过删除 C4001 和 C4179 禁止来避免此警告。 如果代码不需要向后兼容,则仅禁止显示 C4619。
/* C only */
#pragma warning(disable:4619)
#pragma warning(disable:4001)
#pragma warning(disable:4179)
// single line comment
//* also a single line comment */
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈