This is the mail archive of the
mailing list for the GCC project.
Re: style convention: /*foo_p=*/ to annotate bool arguments
On 4 October 2016 at 16:51, <Paul.Koning@dell.com> wrote:
>> On Oct 4, 2016, at 11:46 AM, Jonathan Wakely <email@example.com> wrote:
>> On 4 October 2016 at 16:41, <Paul.Koning@dell.com> wrote:
>>>> On Oct 3, 2016, at 7:48 PM, Martin Sebor <firstname.lastname@example.org> 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 can't fathom why this makes any sense at all. Bool is just another data type. And on top of that, "true" is obviously a value of type bool. I can't imagine any reason why calls should have funny comments in them that appear only for arguments of that particular type.
>> You should get out more :-)
> That's good stuff, but it doesn't justify putting funny comments on boolean arguments, it argues for avoiding boolean in the first place.
Which is what I suggested several hours ago, but that requires code
changes. The comments serve a similar purpose for readers looking at
the call site. IMHO it's not optimal, but it has a similar goal, and
from your bewilderment I assumed you were not aware of that goal. (I
couldn't fathom why saying "true is obviously a value of type bool"
made any sense at all in this context. Nobody suggested adding
comments to clarify that "true" is of type bool.)