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.

And even *if* you evaluate success of a rule just by how well it is
followed, you'll need to look at separate areas of GCC separately,
not just look at one gross number, one randomly defined statistic.


Segher

Reply via email to