Reputation: 3072
I'm using visual studio 2013 and get a lot of C4100 warnings in cases like this
void destroy(pointer p) {//warning C4100
p->~T();
}
i don't understand why. My question how can i avoid this warning without #pragma warning (platform-independence, readability)?
Upvotes: 2
Views: 2123
Reputation: 17999
This is a Visual Studio bug/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.
There should a be bug report, but I cant find it at the moment.
Workarounds:
Reference p
otherwise:
void destroy(pointer p) {
p; //resolve warning C4100
p->~T();
}
Disable the warning:
/W4
or/wd4100
or#pragma warning(disable : 4100)
Use another compiler.
Upvotes: 4