This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


1008. Querying the alignment of an object

Section:  [expr.alignof]     Status: NAD     Submitter: Steve Clamage     Date: 2009-11-27

The current specification of the alignof operator ( [expr.alignof]) allows it to be applied only to types, not to objects. Since the align attribute may be applied to objects, and since existing practice permits querying the alignment of objects, it should be considered whether to allow this in Standard C++ as well.

Additional note, April, 2020:

A survey of current implementations shows that most have already implemented the extension; the example there illustrates one motivation for its use. The principle of least astonishment would suggest that it is surprising for sizeof and alignof to behave differently in this regard.

Additional note (April, 2022)

This is a request for an extension, which is pursued by paper P2152 (Querying the alignment of an object).