- Title
- Use of "structure" without definition
- Status
- cd1
- Section
- Clause [11] [class]
- Submitter
- James Kanze
Created on 2001-12-09.00:00:00 last changed 55 months ago
Messages
Date: 2007-04-15.00:00:00
[Voted into WP at April, 2007 meeting.]
Date: 2006-04-15.00:00:00
Proposed resolution (April, 2006): This issue is resolved by the resolution of
issue 538.
Date: 2022-02-18.07:47:23
Suggested resolution: I suggest something like the following:
If a class is defined with the class-key class , its members and
base classes are private by default. If a class is defined with
the class-key struct ,
its members and base classes are public by
default. If a class is defined with the class-key union , its
members are public by default, and it holds only one data member
at a time. Such classes are called unions, and obey a number of
additional restrictions, see 11.5 [class.union].
Date: 2026-07-25.21:52:10
In Clause 11 [class] paragraph 4, the first sentence says
"A structure is a class
definition defined with the class-key struct ".
As far as I know,
there is no such thing as a structure in C++; it certainly isn't
listed as one of the possible compound types in 6.9.5 [basic.compound].
And defining structures opens the question of whether a forward
declaration is a structure or not. The parallel here with union
(which follows immediately) suggests that structures and classes are
really different things, since the same wording is used, and classes
and unions do have some real differences, which manifest themselves
outside of the definition. It also suggests that since one can't
forward declare union with class and vice versa, the same should
hold for struct and class -- I believe that the intent was that one
could use struct and class interchangeably in forward declaration.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-02-18 07:47:23 | admin | set | messages: + msg6679 |
| 2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
| 2007-08-05 00:00:00 | admin | set | status: dr -> wp |
| 2007-05-06 00:00:00 | admin | set | messages: + msg1503 |
| 2007-05-06 00:00:00 | admin | set | status: ready -> dr |
| 2006-11-05 00:00:00 | admin | set | status: review -> ready |
| 2006-04-22 00:00:00 | admin | set | messages: + msg1323 |
| 2006-04-22 00:00:00 | admin | set | status: open -> review |
| 2001-12-09 00:00:00 | admin | create | |