I see it when I read pugixml source code and I really don't know why it's there.
void foo(void* ptr) {
(void)!ptr; // What does this line do?
}
I see it when I read pugixml source code and I really don't know why it's there.
void foo(void* ptr) {
(void)!ptr; // What does this line do?
}
(void)ptr;
is a common way to suppress "unused parameter" warnings, which may be necessary when the function signature is required to contain more parameters than the function uses (e.g. in a callback, if the 'user data' parameter is not used).
The !
is new to me, though it is superfluous in this context because the return value is just thrown away.