Title
Pointer arithmetic within standard-layout objects
Status
nad
Section
7.6.6 [expr.add]
Submitter
Nikolay Ivchenkov

Created on 2011-05-06.00:00:00 last changed 140 months ago

Messages

Date: 2011-08-15.00:00:00

Rationale (August, 2011):

The current wording is sufficiently clear that this usage is permitted.

Date: 2022-11-20.07:54:16

According to 6.8 [basic.types] paragraph 4,

The object representation of an object of type T is the sequence of N unsigned char objects taken up by the object of type T, where N equals sizeof(T).

and 6.7.2 [intro.object] paragraph 5,

An object of trivially copyable or standard-layout type (6.8 [basic.types]) shall occupy contiguous bytes of storage.

Do these passages make pointer arithmetic (7.6.6 [expr.add] paragraph 5) within a standard-layout object well-defined (e.g., for writing one's own version of memcpy?

History
Date User Action Args
2012-09-24 00:00:00adminsetmessages: + msg4022
2011-05-06 00:00:00admincreate