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/2016 03:08 PM, Jason Merrill wrote:
On Tue, Oct 4, 2016 at 4:29 PM, Zan Lynx <zlynx@acm.org> 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 bar_p = false);

void foo(int x, int y, bool bar_p = false)
{
}

There is really no point to duplicating it. The default value goes into
the headers which is what is read by users of the code.

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 standards made a fundamental mistake -- by having all the API documentation at the implementation rather than at the declaration. Sigh....

Jeff


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