From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1930) id 65F6B385B835; Tue, 31 Mar 2020 02:39:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65F6B385B835 To: gcc-cvs-wwwdocs@gcc.gnu.org Subject: gcc-wwwdocs branch master updated. 00449f252c39605f631af527472db67b1fe53ba2 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 6ae64fd7b9d90950ce53397a298e3b81fffe7a81 X-Git-Newrev: 00449f252c39605f631af527472db67b1fe53ba2 Message-Id: <20200331023926.65F6B385B835@sourceware.org> Date: Tue, 31 Mar 2020 02:39:26 +0000 (GMT) From: Martin Sebor X-BeenThere: gcc-cvs-wwwdocs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs-wwwdocs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Mar 2020 02:39:26 -0000 This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gcc-wwwdocs". The branch, master has been updated via 00449f252c39605f631af527472db67b1fe53ba2 (commit) from 6ae64fd7b9d90950ce53397a298e3b81fffe7a81 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 00449f252c39605f631af527472db67b1fe53ba2 Author: Martin Sebor Date: Mon Mar 30 20:38:51 2020 -0600 PR 61339 - mismatch between struct and class [-Wmismatched-tags] ChangeLog: * htdocs/codingconventions.html (Struct Definitions): Remove old convention. (Class Definitions): Same. * htdocs/codingrationale.html (Struct Definitions): Document convention change. diff --git a/htdocs/codingconventions.html b/htdocs/codingconventions.html index 03a77063..f4732ef6 100644 --- a/htdocs/codingconventions.html +++ b/htdocs/codingconventions.html @@ -888,9 +888,20 @@ Variables may be simultaneously defined and tested in control expressions.

Struct Definitions

-Use the struct keyword for - -plain old data (POD) types. +Some coding conventions, including GCC's own in the past, recommend +using the struct keyword (also known as the class-key) +for +plain old data (POD) types. However, since the POD concept has been +replaced in C++ by a set of much more nuanced distinctions, the current +guidance (though not a requirement) is to use the struct +class-key when defining structures that could be used without +change in C, and use class for all other classes. It is +recommended to use the same class-key consistently in all +declarations and, if necessary, in uses of the class. +The -Wmismatched-tags warning option helps detect mismatches. +The -Wredundant-tags GCC option further helps identify places +where the class-key can safely be omitted. +

@@ -900,14 +911,13 @@ plain old data (POD) types.

Class Definitions

-Use the class keyword for - -non-POD types. +See the guidance in Struct Definitions for +the suggested choice of a class-key.

-A non-POD type will often (but not always) -have a declaration of a +A class defined with the class-key class type will often +(but not always) ave a declaration of a special member function. If any one of these is declared, diff --git a/htdocs/codingrationale.html b/htdocs/codingrationale.html index a2618b64..0b44f1da 100644 --- a/htdocs/codingrationale.html +++ b/htdocs/codingrationale.html @@ -54,15 +54,16 @@ if (info *q = get_any_available_info ()) {

Struct Definitions

-In the C++ standard, -structs and classes differ only in the default access rules. -We prefer to use these two keywords to signal more information. -

- -

-Note that under this definition, -structs may have member functions. -This freedom is useful for transitional code. +In the C++ standard, structs and classes differ only in the default +access rules. In the past, there was a mild preference among some +GCC developers for using these two keywords to indicate whether or +not a class met the criteria for a Plain Old Data (POD) type. +However, this convention was never consistently adhered to or fully +socialized. A review of a patch to + +add support for POD struct convention (PR 61339) revealed that +the convention lacked broad enough support within the GCC developer +community. As a result, the convention was removed.

----------------------------------------------------------------------- Summary of changes: htdocs/codingconventions.html | 26 ++++++++++++++++++-------- htdocs/codingrationale.html | 19 ++++++++++--------- 2 files changed, 28 insertions(+), 17 deletions(-) hooks/post-receive -- gcc-wwwdocs