Re: C++ Coding Standards
Posted: Nov 20, 2004 12:09 AM
As I mentioned in the review phase, I disagree with the monotonicity of the unused parameter item. I can now avail myself of the underhanded option of repeating myself in this public forum, and I find myself unable to resist. ;)
Many developers are diligently using automatic documentation tools, which can be stymied by an anonymous function parameter, and produce warnings of their absence. Since documentation tools may form an important part of an automated build process, it behooves us to get no warnings in that phase, as in any other. Hence, I believe the best, although perhaps not the most beautiful, approach is to do the following:
/// \param name Blah blah blah name blah blah
/// \param code Blah blah blah code blah blah
int func1(char const *name, int code = 0)
STLSOFT_SUPPRESS_UNUSED(code); // or whatever your macro of choice may be
... // Use "name" and do our stuff ...
In this way, we placate the compiler and the documentation generator, and also provide what I'd argue is a more obvious mnemonic to maintainers of the code that we know the argument is unused and we're ok with that.