Question

I've seen this definition GCC_UNUSED used in quite a few places (curses, CDK). I tried searching for it but I couldn't find anything. Does anyone know what it means?

Was it helpful?

Solution

Usually it's a macro definition, something like:

#ifdef __GNUC__
#  define GCC_UNUSED __attribute__((unused))
#else
#  define GCC_UNUSED
#endif

The unused attribute, attached to a variable, means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable.

OTHER TIPS

It's not a GCC macro, it's something the code you're looking at is doing, which is related to GCC.

Most probably a way to avoid "parameter unused"-warnings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top