This is the mail archive of the
mailing list for the GCC project.
Re: style convention: /*foo_p=*/ to annotate bool arguments
On 10/04/2016 12:41 PM, 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.
Isn't that the case for "1" and "2" too?
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).
Yeah, this I could get behind as a guideline (not really a rule) for new