On 10/04/2016 04:41 AM, Jonathan Wakely wrote:
On 4 October 2016 at 10:21, David Brown wrote:
On 04/10/16 01:48, Martin Sebor wrote:
In a recent review Jason and I discussed the style convention
commonly followed in the C++ front end to annotate arguments
in calls to functions taking bool parameters with a comment
along the lines of

  foo (1, 2, /*bar_p=*/true);

I like this convention at the call-site, otherwise "true" or "false"
doesn't tell you much and you have to look at the declaration.

IMHO even better is to not use bool and define an enumeration type, so
the call site has something unambiguous like foo (1, 2, yes_bar) or
foo (1, 2, no_bar).
An enumeration type, overloads or a different function name seem preferable to me, though often the latter two approaches often degrade into precisely what we're trying to avoid.

However, if there's a general agreement that the comments are OK, then I won't argue against them.
Jeff

Reply via email to