What does casting to `void` really do? [duplicate]

Casting to void is used to suppress compiler warnings. The Standard says in §5.2.9/4 says,

Any expression can be explicitly converted to type “cv void.” The
expression value is discarded.

Leave a Comment