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 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. Those users are
the only ones with an interest because it affects the number of
arguments they may need to pass.

The implementation has no interest in what the default value is because
it must handle any value.


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