The C23 attribute [[maybe_unused]] marks a declaration or definition whose identifier might not be used, suppressing the corresponding unused-identifier diagnostic. section 10.2.3
Marking an unused parameter
int main(int, char*[]);\nint argc;\n[[maybe_unused]] char* argv[];\ndouble A[5];\nsize_t I;\n\nHere, argv is declared as an array of pointers to char, and [[maybe_unused]] records that its identifier may not appear later in the program. section 2.2
TAKEAWAY:
- Attach [[maybe_unused]] where a declaration or definition is intentionally allowed to remain unused. section 10.2.3
int main(int, char*[]); int argc; [[maybe_unused]] char* argv[]; double A[5]; size_t I;
Use the declaration listing to inspect how [[maybe_unused]] appears before the argv declaration alongside ordinary C declarations. section 2.2
