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

2016-10-05 Thread Pedro Alves
On 10/05/2016 05:12 PM, Jeff Law wrote: > On 10/04/2016 03:08 PM, Jason Merrill wrote: >> On Tue, Oct 4, 2016 at 4:29 PM, Zan Lynx wrote: >>> On 10/04/2016 02:00 PM, Martin Sebor wrote: This would have been easier if C++ had allowed the same default value to be given in both the dec

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

2016-10-05 Thread Pedro Alves
On 10/04/2016 11:41 AM, Jonathan Wakely wrote: > > 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). Whole-heartily agreed. A quite recent example. On gdb-land, a patch was proposing

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

2016-10-05 Thread Florian Weimer
* David Brown: > Far and away the best solution would be for C++ to support named > parameters or named arguments: > > > > Then you could write: > > foo(1, 2, bar_p: true); > > You could also write > > foo(y: 2, bar_p:

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

2016-10-05 Thread Florian Weimer
* Jeff Law: > On 10/04/2016 03:08 PM, Jason Merrill wrote: >> In GCC sources, I think users look at the function definition more >> often than the declaration in the header, the latter of which >> typically has neither comments nor parameter names. > So true. One could claim that our coding stand

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

2016-10-05 Thread Jason Merrill
On Wed, Oct 5, 2016 at 12:18 PM, wrote: >> On Oct 5, 2016, at 12:12 PM, Jeff Law wrote: >> On 10/04/2016 03:08 PM, Jason Merrill wrote: >>> On Tue, Oct 4, 2016 at 4:29 PM, Zan Lynx wrote: >>> ... >>> In GCC sources, I think users look at the function definition more >>> often than the declarati

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

2016-10-05 Thread Paul.Koning
> On Oct 5, 2016, at 12:12 PM, Jeff Law wrote: > > On 10/04/2016 03:08 PM, Jason Merrill wrote: >> On Tue, Oct 4, 2016 at 4:29 PM, Zan Lynx wrote: >> ... >> In GCC sources, I think users look at the function definition more >> often than the declaration in the header, the latter of which >> typ

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

2016-10-05 Thread Jeff Law
On 10/04/2016 03:08 PM, Jason Merrill wrote: On Tue, Oct 4, 2016 at 4:29 PM, Zan Lynx wrote: On 10/04/2016 02:00 PM, Martin Sebor wrote: This would have been easier if C++ had allowed the same default value to be given in both the declaration and the definition: void foo(int x, int y, bool ba

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

2016-10-05 Thread David Brown
On 04/10/16 22:00, Martin Sebor wrote: >> This would have been easier if C++ had allowed the same default value to >> be given in both the declaration and the definition: >> >> void foo(int x, int y, bool bar_p = false); >> >> void foo(int x, int y, bool bar_p = false) >> { >> } >> >> It seems stra