On Fri, Jun 28, 2019 at 07:46:54PM +0100, Richard Sandiford wrote:
> Segher Boessenkool <seg...@kernel.crashing.org> writes:
> > On Fri, Jun 28, 2019 at 08:55:00AM -0600, Martin Sebor wrote:
> >> Jeff reminded me in a code review the other day that GCC does
> >> have a guideline for defining POD structs with the keyword
> >> "struct" and classes with ctors/dtors using "class":
> >> 
> >>   https://gcc.gnu.org/codingconventions.html#Struct_Use
> >> 
> >> I quickly prototyped a warning to see how closely GCC follows
> >> this convention.  The result shows that out of just under 800
> >> structs and classes defined in GCC sources some 200 use
> >> the keyword 'struct' despite having a ctor or dtor, or about
> >> 25%.  So as is the case with most other conventions, without
> >> a tool to help remind us they exist they are unlikely to be
> >> followed with enough consistency to be worth putting in place
> >> to begin with.
> >
> > The goal is not to have the rules adhered to.  The goal is to have
> > a more readable / maintainable / etc. codebase.
> 
> IMO it's a shame we don't follow that attitude for changelogs,
> where apparently the number of spaces between the name and the email
> address is of vital importance :-)  Too often a new contributor's
> first taste of GCC is a slew of comments about things like that.

Yes.  It is important that people make good enough changelogs though.
But when a new contributor gets no comments other than about their
changelog, well, that is less than ideal, right.

> But surely it's a valid point that we're not following our own
> conventions on the C++ usage.  I miss how consistent the codebase
> was in the C days...

I think you misunderstand me.  We *should* follow our coding conventions.
My point was that even if we break the rules in a quarter of cases, we
still win more than we lose, so this doesn't make the rule useless at all.

That isn't saying we shouldn't follow those rules, pretty much the
opposite.


Segher

Reply via email to