What does void casting do?

c, casting, void

Solution

This cast suppresses a compiler warning that would arise if `data` is not used.

GCC produces this warning if the `-Wunused-parameter` flag (implied by `-Wextra`) is enabled.

Problem

I was reading some source code, and this came up; ``` struct Cookie * Curl_cookie_add(struct SessionHandle *data, /* rest of params were here */) { /* unrelated things were here */ #ifdef CURL_DISABLE_VERBOSE_STRINGS (void)data; #endif /* rest of function goes here */ } ``` As you can see, void casted pointer, isn't even assigned to a variable. I was wondering what is the purpose of this.

Original source

Related problems