This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1314. Pointer arithmetic within standard-layout objects

Section: 7.6.6  [expr.add]     Status: NAD     Submitter: Nikolay Ivchenkov     Date: 2011-05-06

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?

Rationale (August, 2011):

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