This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: style convention: /*foo_p=*/ to annotate bool arguments
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Paul dot Koning at dell dot com
- Cc: Martin Sebor <msebor at gmail dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 4 Oct 2016 16:46:11 +0100
- Subject: Re: style convention: /*foo_p=*/ to annotate bool arguments
- Authentication-results: sourceware.org; auth=none
- References: <672232b9-8cb4-71ad-ece6-e593545a4f07@gmail.com> <5D4FF3BC-E339-48DD-80DA-C4EE55C6833B@dell.com>
On 4 October 2016 at 16:41, <Paul.Koning@dell.com> wrote:
>
>> On Oct 3, 2016, at 7:48 PM, Martin Sebor <msebor@gmail.com> 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 :-)
http://c2.com/cgi/wiki?UseEnumsNotBooleans
https://ariya.io/2011/08/hall-of-api-shame-boolean-trap
http://www.flipcode.com/archives/Replacing_Bool_Arguments_With_Enums.shtml