So I found this macro on SO:
#define UNUSED(x) (void)(sizeof((x), 0))
and this (still) produces the following warning:
main.c:11:36: warning: left-hand operand of comma expression has no effect [-Wunused-value] #define UNUSED(x) (void)(sizeof((x), 0))
Whereas the simpler version, a normal void
cast: #define UNUSED(x) (void)(x)
is warning-free.
What could be the reason behind it? In general warnings are a sign of high-risk situations. Is here the given warning really useful?
I am interested in C-explanation.