Reason behind using (void)someInt; in code

c++

Solution

To avoid a compiler warning/error indicating that the variable was unused in the function body. It's a style choice, the other way to achieve the same effect would be to leave the variable un-named:

void someFunction(Foo& a, int /*index*/, int /*partId*/)

Problem

I am reading some code of a library I am using, and I found that in a function this was used: ``` void someFunction(Foo& a, int index, int partId) { (void) partId; (void) index; // more code } ``` Anyone knows why? Thanks.

Original source