This is the mail archive of the 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: [PATCH 0/3] add support for POD struct convention (PR 61339)

On Mon, Jul 08, 2019 at 03:56:51PM -0600, Martin Sebor wrote:
> A couple of GCC's Coding Conventions call to
>   1) Use the struct keyword for plain old data (POD) types.
> and
>   2) Use the class keyword for non-POD types.

This is a coding convention that has been added without any discussion
whatsoever on that, maybe it was some Google internal coding convention or
something, do we really want to enforce it rather than discuss
and decide what we actually want?

With my limited C++ knowledge, the main distinction between struct and class
when both can appear interchangeably is that struct defaults to public:
and class defaults to private:, and I think it is best to use those that
way, rather than having tons of class ... { public: ... } everywhere.

There are many C++ class boolean properties, rather than just
POD vs. non-POD and we could pick any of them instead of this particular one
for the struct vs. class distinction if we wanted to enforce it, but why?

I'd just arrange that when being compiled with clang we compile with
-Wno-mismatched-tags to get rid of their misdesigned warning and not add
such misdesigned warning to GCC, that will just help people spread this
weirdo requirement further.


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