i’m reading the source code of http-parser and came across some if statements with empty blocks. here’s an example (source)
int
dontcall_message_begin_cb (http_parser *p)
{
if (p) { } // gcc
fprintf(stderr, "\n\n*** on_message_begin() called on paused parser ***\n\n");
abort();
}
the comment merely mentions ‘gcc’ which (to me) is not very helpful. what is the point of these?
My guess is someone trying to suppress the “unused parameter” warning.
The canonical way to do this is
(void)p;, but I’m guessing the author of the code didn’t know about that.