What does (void) mean in c++?

c++

Solution

What you see there is really just a "trick" to fake variable/parameter usage.

Without those lines, a pedantic compiler will warn you about the variables not being used.

Using a construct `(void)variablename;` will result in no instructions being generated, but the compiler will consider it a valid "use" of those variables.

Problem

I'm looking at some code that has a function that looks like this: ``` void f(A* a, B& b, C* c) { (void)a; (void)b; (void)c; } ``` What exactly does the (void) at the start of every line do?

Original source

Related problems