This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: style convention: /*foo_p=*/ to annotate bool arguments


On 10/04/16 08:35, Segher Boessenkool wrote:
On Tue, Oct 04, 2016 at 07:40:09AM -0400, Nathan Sidwell wrote:
On 10/03/16 19: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 if there's more than one boolean arg.  If there's only one, I'm
ambivalent.

It often is more readable and natural to have a separate "foo_bar"
function for "bar_p = true" (inline perhaps) than to use default
arguments, after which all these comment workarounds go away.

I take it you've not looked at the c++ parser :)

static cp_expr cp_parser_unqualified_id
  (cp_parser *, bool, bool, bool, bool);

combinatorial explosion time

nathan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]