3 ms·
If it's C code, that is the way to suppress a compiler warning about sig being unused. In C++ you can omit (or comment-out) the parameter name, e.g.: // C+
by naruhodo 2y ago
If it's C code, that is the way to suppress a compiler warning about sig being unused. In C++ you can omit (or comment-out) the parameter name, e.g.:
// C++
void on_sigchld(int /*sig*/) {}
- JackSlateur 2y agoThank you So this would be a way which predates' C23's maybe_unused attribute¹ Nice trick [1] https://en.cppreference.com/w/c/language/attributes/maybe_unused https://en.cppreference.com/w/c/language/attributes/maybe_un...
- naruhodo 2y agoC23 includes support for just omitting the parameter name, as with C++.
- kevin_thibedeau 2y agoThat is K&R C syntax, supported up to C18. The solution to tools emitting unwanted diagnostics is not to appease them with pointless cruft but to shut off the diagnostic: -Wall -Wextra -Wno-unused-parameter