Ask Your Question

Revision history [back]

Yes, one can use the "attribute((unused))" directive to inform the compiler that a specific variable may be unused, and thus avoid receiving false positive warnings for that variable when using the "-Wall" flag. For example:

int main() {
    int x attribute((unused));   // inform compiler that x may be unused
    return 0;
}

This will inform the compiler that the variable "x" may be unused and prevent false positive warnings for that variable.