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: C++ coding style inconsistencies


On 25 June 2015 at 19:28, Richard Sandiford wrote:
> (2) Is there supposed to be a space before a template parameter list?
>     I.e. is it:
>
>        foo<bar>
>
>     or:
>
>        foo <bar>
>
>     ?  Both are widely used.
>
>     The current coding conventions don't say explicitly, but all the
>     examples use the second style.  It's also more in keeping with
>     convention for function parameters.  On the other hand, it could
>     be argued that the space in:
>
>        foo <bar, frob>::thing
>
>     makes the binding confusing and looks silly compared to:
>
>        foo<bar, frob>::thing
>
>     But there again, the second one might look like two unrelated
>     blobs at first glance.

I think the extra space makes no sense here, and I've not seen it used
in idiomatic C++.

The name of the type is "foo<bar, frob>", it's not a function call.

If the point is just to break things up with whitespace (which does
seem to be the motivation for the space before function parameters in
the GNU style) then

    foo<bar, frob> :: thing

 might make more sense (and some people do use that style but I don't
like it personally).


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