This is the mail archive of the
mailing list for the GCC project.
Re: C++ coding style inconsistencies
- From: Jeff Law <law at redhat dot com>
- To: David Malcolm <dmalcolm at redhat dot com>, Richard Sandiford <rdsandiford at googlemail dot com>, gcc at gcc dot gnu dot org
- Date: Fri, 26 Jun 2015 09:05:51 -0600
- Subject: Re: C++ coding style inconsistencies
- Authentication-results: sourceware.org; auth=none
- References: <87vbeblk0y dot fsf at googlemail dot com> <1435265991 dot 13727 dot 52 dot camel at surprise> <20150626095058 dot GG18873 at virgil dot suse>
On 06/26/2015 03:50 AM, Martin Jambor wrote:
But it (CppConventions in the wiki) also has a note that the top that
makes it explicit that the information on that page is obsolete and
refers the reader to the official conventions.
On Thu, Jun 25, 2015 at 04:59:51PM -0400, David Malcolm wrote:
On Thu, 2015-06-25 at 19:28 +0100, Richard Sandiford wrote:
Sorry in advance for inviting a bikeshed discussion, but while making
the hashing changes that I just committed, I noticed that the C++ification
has been done in a variety of different styles. I ended up having to follow
the "do what the surrounding code does" principle that some code bases have,
but to me that's always seemed like an admission of failure. One of the
strengths of the GCC code base was always that it was written in a very
consistent style. Regardless of what you think of that style (I personally
like it, but I know others don't at all), it was always easy to work on
a new area of the compiler without having to learn how the surrounding code
preferred to format things. It would be a shame if we lost that in the
rush to make everything "more C++".
If we're bike-shedding (sorry, I'm waiting for a bootstrap), do we have
a coding standard around the layout of member initialization in
i.e. should it be:
foo::foo (int x, int y) :
foo::foo (int x, int y)
: m_x (x),
according to the document, the semicolon should be on the first column
if all initializers do not fit on one line with the definition. Emacs
gnu-style indentation does not do that and produces your second case
above, which, according to some simple grepping, is also greatly
prevails in the codebase now. So perhaps we should change the rule?
(how much indentation?)
I'd be wary of citing and using this document, IIRC it sometimes
contradicts the official one and was meant as a basis for discussion
when we were discussing whether to switch to gcc in the first place.