Title
Padding in class types
Status
open
Section
7.6.2.5 [expr.sizeof]
Submitter
Jim X

Created on 2022-07-19.00:00:00 last changed 29 months ago

Messages

Date: 2022-07-16.08:34:33

Suggested resolution:

Change in 7.6.2.5 [expr.sizeof] paragraph 2

... When applied to a class, the result is the number of bytes in an object of that class including any padding required for placing objects of that type in an array. The amount and placement of padding in a class type is unspecified. The result of applying sizeof to a potentially-overlapping subobject is the size of the type, not the size of the subobject. [ Footnote: ... ]
Date: 2022-07-19.00:00:00

Class types may have padding, influencing the result of sizeof. It is unclear whether the placement and amount of padding is implementation-defined, unspecified, or something else. If it is unspecified, the limits of permissible behavior are unclear. Empty classes might need special consideration.

History
Date User Action Args
2022-07-19 00:00:00admincreate
2022-07-16 08:34:33adminsetmessages: + msg6888