F.9: Unused parameters should be unnamed(不用的参数应该去掉名字)
Reason(原因)
Readability. Suppression of unused parameter warnings.
这样做可以增加可读性。这样做可以抑制“没有使用的参数”关联的警告。
Example(示例)
X* find(map<Blob>& m, const string& s, Hint); // once upon a time, a hint was used
译者注:最后一个参数为Hint类型,从前曾经使用过,现在已经不需要了。
Note(注意)
Allowing parameters to be unnamed was introduced in the early 1980 to address this problem.
为了解决这个问题,早在1980年就导入了允许参数无名化的特性。
译者注:
译者注:非常遗憾到今天还是有很多人不知道这件事。
Enforcement(实施建议)
Flag named unused parameters.
标记没有使用的参数。
阅读更多更新文章,请关注微信公众号【面向对象思考】