避免在 visual-studio 中出现讨厌的警告 C4100
Avoid nasty warning C4100 in visual-studio
我正在使用 visual studio 2013,在这种情况下收到很多 C4100 警告
void destroy(pointer p) {//warning C4100
p->~T();
}
我不明白为什么。我的问题是如何在没有#pragma 警告(平台独立性、可读性)的情况下避免此警告?
这是一个Visual Studiobug/limitation。
C4100 can also be issued when code calls a destructor on a otherwise unreferenced parameter of primitive type. This is a limitation of the Visual C++ compiler.
应该有错误报告,但我暂时找不到。
解决方法:
参考p
否则:
void destroy(pointer p) {
p; //resolve warning C4100
p->~T();
}
禁用警告:
- 在没有
/W4
或 的情况下编译
- 用
/wd4100
或 编译
- 添加
#pragma warning(disable : 4100)
使用其他编译器。
我正在使用 visual studio 2013,在这种情况下收到很多 C4100 警告
void destroy(pointer p) {//warning C4100
p->~T();
}
我不明白为什么。我的问题是如何在没有#pragma 警告(平台独立性、可读性)的情况下避免此警告?
这是一个Visual Studiobug/limitation。
C4100 can also be issued when code calls a destructor on a otherwise unreferenced parameter of primitive type. This is a limitation of the Visual C++ compiler.
应该有错误报告,但我暂时找不到。
解决方法:
参考
p
否则:void destroy(pointer p) { p; //resolve warning C4100 p->~T(); }
禁用警告:
- 在没有
/W4
或 的情况下编译
- 用
/wd4100
或 编译
- 添加
#pragma warning(disable : 4100)
- 在没有
使用其他编译器。