<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<title>C and C++ Alignment Compatibility</title>
<style type="text/css">
td { vertical-align: top; }
</style>
</head>
<body>
<h1>C and C++ Alignment Compatibility</h1>

<p>
ISO/IEC JTC1 SC22 WG14 N1447 - 2010-03-22
<br>
ISO/IEC JTC1 SC22 WG21 N3093 = 10-0083 - 2010-03-22
</p>

<p>
Lawrence Crowl,
crowl@google.com,
Lawrence@Crowl.org
</p>

<p>
<a href="#Introduction">Introduction</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Fundamental">Fundamental Alignment</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Operator">Alignof Operator</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Declaring">Declaring Alignment</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Semantics">Alignment Semantics</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Allocation">Aligned Allocation</a><br>
<a href="#WordingC">Proposed Wording for C</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#4.">4. Conformance</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#6.2.8">6.2.8 Alignment of objects</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#6.4.1">6.4.1 Keywords</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#6.7.5">6.7.5 Alignment specifier</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#7.1.2">7.1.2 Standard headers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#7.new">7.new Alignment <code>&lt;stdalign.h&gt;</code></a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#A.1.2">A.1.2 Keywords</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#A.2.2">A.2.2 Declarations</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#B.new">B.new Alignment <code>&lt;stdalign.h&gt;</code></a><br>
<a href="#WordingCPP">Proposed Wording for C++</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#intro.scope">1.1 Scope [intro.scope]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#lex.key">2.12 Keywords [lex.key]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#basic.def.odr">3.2 One definition rule [basic.def.odr]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#basic.align">3.11 Alignment [basic.align]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#dcl.spec">7.1 Specifiers [dcl.spec]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#dcl.align">7.1.7 Alignment specifiers [dcl.align]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#dcl.align.old">7.6.2 Alignment attribute [dcl.align]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#headers">17.6.1.2 Headers [headers]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#support.general">18.1 General [support.general]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#support.runtime">18.10 Other runtime support [support.runtime]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#meta.trans.other">20.7.6.6 Other transformations [meta.trans.other]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#depr.c.headers">D.5 C standard library headers [depr.c.headers]</a><br>
</p>


<h2><a name="Introduction">Introduction</a></h2>

<p>
The compatibility between the C and C++ alignment facilities
is important to many members of the respective communities.
This paper analyses the compatibility between the draft standards,
WG14
<a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1425.pdf">N1425</a>.
and N3035,
WG21
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3035.pdf">N3035</a>.
with respect to alignment.
</p>

<p>
This document presents what we believe to be the consensus proposal
of the C and C++ compatibility mailing list.
It incorporates detailed proposed wording for both standards.
</p>


<h3><a name="Fundamental">Fundamental Alignment</a></h3>

<p>
Both languages have the same notion of
fundamental alignment (&lt;=&nbsp;<code>alignof(max_align_t)</code>) and
extended alignment (&gt;&nbsp;<code>alignof(max_align_t)</code>).
Extended alignment support is implementation-defined in both languages.
</p>

<p>
Both languages intend to constrain the alignments to powers of two,
but the wording to do so is confusing,
and likely subject to misinterpretation.
In particular, the 'weaker' constraint does not seem to be satisfiable
unless the alignments are restricted to powers of two.
Explicitly restricting alignment to powers of two
would improve both languages.
</p>


<h4>Proposal</h4>

<p>
Explicitly constrain alignments to powers of two.
</p>


<h3><a name="Operator">Alignof Operator</a></h3>

<p>
Both C and C++ define an <code>alignof</code> operator.
These have compatible syntax and semantics:
</p>

<dl>
<dt><var>unary-expression:</var></dt>
<dd><code>alignof (</code> <var>type-name/id</var> <code>)</code></dd>
</dl>

<p>
Neither language provides an <code>alignof</code> rule for expressions.
</p>

<dl>
<dt><var>unary-expression:</var></dt>
<dd><code>alignof </code> <var>unary-expression</var></dd>
</dl>

<p>
In both languages, the result is of type <code>size_t</code>,
and the results are meaningfully comparable.
</p>


<h3><a name="Declaring">Declaring Alignment</a></h3>

<p>
It is in the declaration of alignment
that C and C++ differ significantly.
</p>

<p>
C adds alignment-specifiers to its grammar.
</p>

<dl>
<dt><var>declaration-specifiers:</var></dt>
<dd><var>alignment-specifier declaration-specifiers<sub>opt</sub></var></dd>
<dt><var>alignment-specifier:</var></dt>
<dd><code>_Align (</code> <var>type-name</var> <code>)</code></dd>
<dd><code>_Align (</code> <var>constant-expression</var> <code>)</code></dd>
</dl>

<p>
The original C++ proposal did essentially the same,
but with a different keyword.
</p>

<dl>
<dt><var>decl-specifier:</var></dt>
<dd><var>alignment-specifier</var></dd>
<dt><var>alignment-specifier:</var></dt>
<dd><code>alignas (</code> <var>type-id</var> <code>)</code></dd>
<dd><code>alignas (</code> <var>constant-expression</var> <code>)</code></dd>
</dl>

<p>
However,
the current C++ working draft uses attributes.
</p>

<dl>
<dt><var>simple-declaration:</var></dt>
<dd><var>attribute-specifier<sub>opt</sub>
	declaration-specifiers<sub>opt</sub>
	attribute-specifier<sub>opt</sub>
	init-declarator-list<sub>opt</sub></var>
	<code>;</code></dd>
</dl>

<p>
where the alignment attribute is one of:
</p>

<dl>
<dt><var>attribute:</var></dt>
<dd><code>align (</code> <var>type-name</var> <code>)</code></dd>
<dd><code>align (</code> <var>assignment-expression</var> <code>)</code></dd>
</dl>

<p>
and where the <var>assignment-expression</var>
shall be an integral constant expression.
</p>


<h4>Proposal</h4>

<p>
Spell the C1x keyword as "<code>_Alignas</code>",
and revert the C++ proposal to a keyword:
</p>

<dl>
<dt><var>decl-specifier:</var></dt>
<dd><var>alignment-specifier</var></dd>
<dt><var>alignment-specifier:</var></dt>
<dd><code>alignas (</code> <var>type-id</var> <code>)</code></dd>
<dd><code>alignas (</code> <var>constant-expression</var> <code>)</code></dd>
</dl>

<p>
Introduce a system header, <code>&lt;stdalign.h&gt;</code>,
analagous to <code>&lt;stdbool.h&gt;</code>,
that creates an identical spelling in both C and C++ for the keyword.
Example:
</p>

<p><code>
#ifndef __cplusplus
<br>
#define alignas _Alignas
<br>
#define __alignas_is_defined 1
<br>
#endif
</code></p>


<h3><a name="Semantics">Alignment Semantics</a></h3>

<p>
Fortunately,
C and C++ have very similar semantics for the effect of declaring alignment.
</p>

<ul>
<li><p>
Type alignment, <code>make_align(</code><var>type</var><code>)</code>,
is defined as <code>make_align(alignof(</code><var>type</var><code>))</code>.
</p></li>

<li><p>
Alignment to zero has no effect.
</p></li>

<li><p>
When multiple alignments are specified, the strictest takes effect.
</p></li>

<li><p>
It is unclear what happens when there are multiple alignments and one is zero.
Does that one alignment have no effect,
or is there no effect on the declaration?
</p></li>

<li><p>
If different translation units have different alignments,
the behavior is undefined.
</p></li>

</ul>

<p>
However, there are some differences.
</p>

<ul>

<li><p>
Both C and C++ explicitly disallow alignment to less than the natural alignment.
This facility is useful for accessing legacy binary files.
However, relaxed alignments on pointers
cause serious implementation problems
for garbage-collected C++0x implementations.
One potential compromise is to allow it for integers, but not for pointers.
</p></li>

<li><p>
C requires subsequent declarations to have the same or no alignment.
C++ requires the non-defining declarations to have the same or no alignment.
Always specifying alignment would be compatible in both languages,
but not doing so only sometimes.
</p></li>

</ul>


<h4>Proposal</h4>

<p>
Define each individual alignment to zero to have no effect.
That is, when there are multiple alignments specified,
only alignments to zero have no effect.
</p>

<p>
A portable program cannot make use of relaxed alignment,
so we propose that it remains disallowed in C and in C++. 
</p>

<p>
Require that a definition or a tentative definition specifies the alignment;
other declarations shall have the same alignment or no alignment.
</p>


<h3><a name="Allocation">Aligned Allocation</a></h3>

<p>
C defines an <code>aligned_alloc</code> function.
C++ appears to add nothing for aligned allocation,
though does leave some support implementation-defined.
</p>


<h4>Proposal</h4>

<p>
Update the C++ working draft section 1.2 [intro.refs]
to refer to the 2011 C standard.
This date may need to change.
</p>


<h2><a name="WordingC">Proposed Wording for C</a></h2>

<p>
These edits are relative to working draft WG14
<a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1425.pdf">N1425</a>.
</p>


<h3><a name="4.">4. Conformance</a></h3>

<p>
Add <code>&lt;stdalign.h&gt;</code>
to the list of headers for freestanding implementations
in paragraph 6.
</p>

<p>
Add <code>&lt;stdalign.h&gt;</code>
to the list of forward references.
</p>


<h3><a name="6.2.8">6.2.8 Alignment of objects</a></h3>

<p>
Edit paragraph 1 as follows.
</p>

<blockquote>
<p>
Object types have alignment requirements
which place restrictions on the addresses
at which objects of that type may be allocated.
An alignment is an implementation-defined integer value
representing the number of bytes between successive addresses
at which a given object can be allocated.
An object type imposes an alignment requirement
on every object of that type:
stricter alignment can be requested
using the <del><code>_Align</code></del>
<ins><code>_Alignas</code></ins> keyword.
</p>
</blockquote>

<p>
Edit paragraph 3 as follows.
</p>

<blockquote>
<p>
An <def>extended alignment</def>
is represented by an alignment greater than <code>alignof(max_align_t)</code>.
It is implementation-defined whether any extended alignments
are supported and the contexts in which they are supported.
A type having an extended alignment requirement
is an <def>over-aligned</def> type.
<del>
[<i>Footnote:</i>
It is intended that every valid alignment value is an integral power of two.
&mdash;<i>end footnote</i>]
</del>
<ins>
Every alignment value shall be an integral power of two.
</ins>
</p>
</blockquote>


<h3><a name="6.4.1">6.4.1 Keywords</a></h3>

<p>
In paragraph 1,
change <code>_Align</code> to <code>_Alignas</code>.
</p>


<h3><a name="6.7.5">6.7.5 Alignment specifier</a></h3>

<p>
In paragraph 1,
change <code>_Align</code> to <code>_Alignas</code>.
</p>

<p>
In paragraph 5,
change <code>_Align</code> to <code>_Alignas</code>.
</p>

<p>
Edit paragraph 6 as follows.
</p>

<blockquote>
<p>
The alignment requirement of the declared object or field
is taken to be the specified alignment.
An alignment specification of zero has no effect.
<ins>
[<i>Footnote:</i>
An alignment specification of zero also does not affect
other aligment specifications in the same declaration.
&mdash;<i>end footnote:</i>]
</ins>
When multiple alignment specifiers occur in a declaration,
the effective alignment requirement is the strictest specified alignment.
</p>
</blockquote>

<p>
Edit paragraph 7 as follows.
</p>

<blockquote>
<p>
If the definition of an object has an alignment specifier,
any other declaration of that object
shall either specify equivalent alignment or have no alignment specifier.
<ins>If the definition of an object does not have an alignment specifier,
any other declaration of that object
shall have no alignment specifier.</ins>
If declarations of an object in different translation units
have different alignment specifiers,
the behavior is undefined.
</p>
</blockquote>


<h3><a name="7.1.2">7.1.2 Standard headers</a></h3>

<p>
Add <code>&lt;stdalign.h&gt;</code>
to the list of standard headers
in paragraph 2.
</p>


<h3><a name="7.new">7.new Alignment <code>&lt;stdalign.h&gt;</code></a></h3>

<p>
Add a new section after
"7.17 Boolean type and values <code>&lt;stdbool.h&gt;</code>.
</p>

<p>
Add a new paragraph 1 as follows.
</p>

<blockquote>
<p><ins>
The header <code>&lt;stdalign.h&gt;</code> defines two macros.
</ins></p>
</blockquote>

<p>
Add a new paragraph 2 as follows.
</p>

<blockquote>
<p><ins>
The macro
</ins></p>
<blockquote>
<p><ins>
<code>alignas</code>
</ins></p>
</blockquote>
<p><ins>
expands to <code>_Alignas</code>.
</ins></p>
</blockquote>

<p>
Add a new paragraph 3 as follows.
</p>

<blockquote>
<p><ins>
The remaining macro
is suitable for use in <code>#if</code> preprocessing directives.
It is
</ins></p>
<blockquote>
<p><ins>
<code>__alignas_is_defined</code>
</ins></p>
</blockquote>
<p><ins>
which expands to the integer constant 1.
</ins></p>
</blockquote>


<h3><a name="A.1.2">A.1.2 Keywords</a></h3>

<p>
In paragraph (6.4.1),
change <code>_Align</code> to <code>_Alignas</code>.
</p>


<h3><a name="A.2.2">A.2.2 Declarations</a></h3>

<p>
In paragraph (6.7.5),
change <code>_Align</code> to <code>_Alignas</code>.
</p>


<h3><a name="B.new">B.new Alignment <code>&lt;stdalign.h&gt;</code></a></h3>

<p>
Add a new section as follows.
</p>

<blockquote>
<p><ins>
<code>alignas</code>
<br>
<code>__alignas_is_defined</code>
</ins></p>
</blockquote>


<h2><a name="WordingCPP">Proposed Wording for C++</a></h2>

<p>
The proposed wording mostly reverts the alignment specification
to that of WG21
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf">N2341</a>,
which was adopted in July 2007.
These edits are relative to working draft WG21
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3035.pdf">N3035</a>.
</p>


<h3><a name="intro.scope">1.1 Scope [intro.scope]</a></h3>

<p>
Edit paragraph 2 as follows.
Note that this edit may need to be delayed until the C standard appears.
</p>

<blockquote>
<p>
C++ is a general purpose programming language
based on the C programming language
as described in
ISO/IEC 9899:<del>1999</del><ins>2011</ins> Programming languages &mdash; C
(hereinafter referred to as the C standard ).
In addition to the facilities provided by C,
C++ provides additional data types, classes, templates, exceptions,
name spaces, inline functions, operator overloading,
function name overloading, references, free store management operators,
and additional library facilities.
</p>
</blockquote>


<h3><a name="lex.key">2.12 Keywords [lex.key]</a></h3>

<p>
Add the keyword <code>alignas</code>
before the keyword <code>alignof</code>.
</p>


<h3><a name="basic.def.odr">3.2 One definition rule [basic.def.odr]</a></h3>

<p>
Edit within paragraph 4 as follows.
</p>

<blockquote>
<ul>
<li><p>...</p></li>
<li><p>
the type T is the subject of an alignof expression (5.3.6)
<ins>or an <code>alignas</code> specifier ([dcl.align])</ins>, or
</p></li>
<li><p>...</p></li>
</ul>
</blockquote>


<h3><a name="basic.align">3.11 Alignment [basic.align]</a></h3>

<p>
Edit paragraph 1 as follows.
Note the inserted comma.
</p>

<blockquote><p>
Object types have <def>alignment requirements</def> (3.9.1, 3.9.2)
which place restrictions on the addressses
at which an object of that type may be allocated.
An <def>aligment</def> is an implementation-defined integer value
representing the number of bytes between successive addresses
at which a given object can be allocated.
An object type imposes an alignment requirement on every object of that type;
stricter alignment can be requested
using <del>the alignment attribute (7.6.2)</del>
<ins><code>alignas</code> ([dcl.align])</ins>.
</p></blockquote>

<p>
Edit paragraph 4 as follows.
</p>

<blockquote>
<p>
Alignments are represented as values of the type <code>std::size_t</code>.
Valid alignments include only those values
returned by an <code>alignof</code> expression
for the fundamental types
plus an additional implementation-defined set of values<ins>,</ins>
which may be empty.
<del>
[<i>Footnote:</i>
It is intended that every valid alignment value be an integral power of two.
&mdash;<i>end footnote</i>]
</del>
<ins>
Every alignment value shall be an integral power of two.
</ins>
</p>
</blockquote>


<h3><a name="dcl.spec">7.1 Specifiers [dcl.spec]</a></h3>

<p>
Edit paragraph 1 as follows.
</p>

<blockquote>
<p>
The specifiers that can be used in a declaration are
</p>
<blockquote><dl>
<dt><var>decl-specifier:</var></dt>
<dd><var>storage-class-specifier</var></dd>
<dd><var>type-specifier</var></dd>
<dd><var>function-specifier</var></dd>
<dd><ins><var>alignment-specifier</var></ins></dd>
<dd><code>friend</code></dd>
<dd><code>typedef</code></dd>
<dd><code>constexpr</code></dd>
<dt><var>decl-specifier-seq:</var></dt>
<dd><var>decl-specifier-seq<sub>opt</sub> decl-specifier</var></dd>
</dl>
</blockquote>
</blockquote>


<h3><a name="dcl.align">7.1.7 Alignment specifiers [dcl.align]</a></h3>

<p>
Add a new section as follows.
Editorially, this section might better appear after
7.1.2 Function specifiers [decl.fct.spec]
in keeping with its position in the grammar.
</p>

<p>
Add paragraph 1 as follows.
</p>

<blockquote>
<p><ins>
The alignment specifier has the form
</ins></p>
<blockquote>
<dl>
<dt><ins><var>alignment-specifier:</var></ins></dt>
<dd><ins><code>alignas (</code>
<var>type-id</var> <code>)</code></ins></dd>
<dd><ins><code>alignas (</code>
<var>constant-expression</var> <code>)</code></ins></dd>
</dl>
</blockquote>
</blockquote>

<p>
Add paragraph 2 as follows.
</p>

<blockquote>
<p><ins>
When the alignment specifier is of the form
<code>alignas(</code><var>constant-expression</var><code>)</code>:
</ins></p>
<ul>
<li>
<p><ins>
the constant expression shall be an integral constant expression
</ins></p>
</li>
<li>
<p><ins>
if the constant expression evaluates to a fundamental alignment,
the alignment requirement of the declared object
shall be the specified fundamental alignment
</ins></p>
</li>
<li>
<p><ins>
if the constant expression evaluates to an extended alignment
and the implementation supports that alignment
in the context of the declaration,
the alignment of the declared object shall be that alignment
</ins></p>  
</li>
<li>
<p><ins>
if the constant expression evaluates to an extended alignment
and the implementation does not support that alignment
in the context of the declaration,
the program is ill-formed
</ins></p>  
</li>
<li>
<p><ins>
if the constant expression evaluates to zero,
the alignment specifier shall have no effect.
[<i>Footnote:</i>
An alignment specification of zero also does not affect
other aligment specifications in the same declaration.
&mdash;<i>end footnote:</i>]
</ins></p>
</li>
<li>
<p><ins>
otherwise, the program is ill-formed
</ins></p>  
</li>
</ul>
</blockquote>

<p>
Add paragraph 3 as follows.
</p>

<blockquote>
<p><ins>
When the alignment specifier
is of the form <code>alignas(</code><var>type-id</var><code>)</code>,
it shall have the same effect as
<code>alignas(alignof(</code><var>type-id</var><code>))</code> ([expr.alignof]).
</ins></p>
</blockquote>

<p>
Add paragraph 4 as follows.
</p>

<blockquote>
<p><ins>
When multiple alignment specifiers are specified for an object,
the alignment requirement shall be set to the strictest specified alignment.
</ins></p>
</blockquote>

<p>
Add paragraph 5 as follows.
</p>

<blockquote>
<p><ins>
The combined effect of all alignment specifiers in a declaration
shall not specify an alignment
that is less strict than the alignment
that would otherwise be required for the object being declared.
</ins></p>
</blockquote>

<p>
Add paragraph 6 as follows.
</p>

<blockquote>
<p><ins>
An alignment specifier shall not be specified in a declaration of
a typedef, or a bit-field, or a reference,
or a function parameter or return type,
or an object declared with the <code>register</code> storage-class specifier.
[<i>Note:</i>
In short,
the specifier can be used on automatic variables,
namespace scope variables,
and members of class types
(as long as they are not bit-fields).
In other words,
it cannot be used in contexts where it would become part of a type
and therefore would affect name mangling,
name lookup or ordering of function templates.
&mdash;<i>end note</i>]
</ins></p>
</blockquote>

<p>
Add paragraph 7 as follows.
</p>

<blockquote>
<p><ins>
If the defining declaration of an object has an alignment specifier,
any non-defining declaration of that object
shall either specify equivalent alignment or have no alignment specifier.
If the defining declaration of an object does not have an alignment specifier,
any non-defining declaration of that object
shall have no alignment specifier.
No diagnostic is required
if declarations of an object have different alignment specifiers
in different translation units.
</ins></p>
</blockquote>

<p>
Add paragraph 8 as follows.
</p>

<blockquote>
<p><ins>
[<i>Example:</i>
An aligned buffer,
with an alignment requirement of <code>A</code>
and an element type <code>T</code>
other than <code>char</code>, <code>signed char</code>
or <code>unsigned char</code>,
can be declared as:
</ins></p>
<blockquote><ins><code>
T alignas(T) alignas(A) buffer[N];<br>
// where N is the number of T elements making up the buffer
</code></ins></blockquote>
<p><ins>
Specifying
<code>alignas(T)</code> in the alignment specifier list
will ensure that the final requested alignment
will not be weaker than <code>alignof(T)</code>,
and therefore the program will not be ill-formed.
&mdash;<i>end example</i>]
</ins></p>
</blockquote>

<p>
Add paragraph 9 as follows.
</p>

<blockquote>
<p><ins>
[<i>Note:</i>
The alignment of a union type can be strengthened
by applying the alignment specifier to any member of the union.
&mdash;<i>end note</i>]
[<i>Note:</i>
The <code>aligned_union</code> template ([meta.type.synop])
can be used to create a union
containing a type with a non-trivial constructor or destructor.
&mdash;<i>end note</i>]
</ins></p>
</blockquote>

<p>
Add paragraph 10 as follows.
</p>

<blockquote>
<p><ins>
[<i>Example:</i>
</ins></p>
<blockquote>
<p><ins>
<code>alignas(double) void f();</code>
<i>// error: alignment applied to function</i>
<br>
<code>alignas(double) unsigned char a[sizeof(double)];</code>
<i>// array of characters, suitably aligned for a</i> <code>double</code>
<br>
<code>extern unsigned char a[sizeof(double)];</code>
<i>// no <code>alignas</code> necessary</i>
<br>
<code>extern alignas(float) unsigned char a[sizeof(double)];</code>
<i>// error: different alignment in declaration</i>
</ins></p>
</blockquote>
<p><ins>
&mdash;<i>end example</i>]
</ins></p>
</blockquote>


<h3><a name="dcl.align.old">7.6.2 Alignment attribute [dcl.align]</a></h3>

<p>
Remove this section.
</p>


<h3><a name="headers">17.6.1.2 Headers [headers]</a></h3>

<p>
Add <code>&lt;cstdalign&gt;</code>
to "Table 14 &mdash; C++ headers for C library facilities".
</p>


<h3><a name="support.general">18.1 General [support.general]</a></h3>

<p>
Add <code>&lt;cstdalign&gt;</code>
to "Table 16 &mdash; Language support library summary"
under "18.10 Other runtime support".
</p>


<h3><a name="support.runtime">18.10 Other runtime support [support.runtime]</a></h3>

<p>
Add a new table after
"Table 26 &mdash; Header <code>&lt;cstdbool&gt;</code> synopsis".
</p>

<blockquote>
<table border=1>
<caption>Table ?? &mdash; Header <code>&lt;cstdalign&gt;</code> synopsis".
<thead>
<tr>
<th><ins>Type</ins></th>
<th><ins>Names(s)</ins></th>
</tr>
</thead>
<tbody>
<tr>
<th><ins>Macro:</ins></th>
<td><ins><code>__alignas_is_defined</code></ins></td>
</tr>
</tbody>
</table>
</blockquote>

<p>
Add a new paragraph after paragraph 6.
</p>

<blockquote>
<p>
<ins>The header <code>&lt;cstdalign&gt;</code>
and the header <code>&lt;stdalign.h&gt;</code>
shall not define a macro named <code>alignas</code>.</ins>
</p>
</blockquote>


<h3><a name="meta.trans.other">20.7.6.6 Other transformations [meta.trans.other]</a></h3>

<p>
Edit table 51 as follows.
</p>

<table border=1>
<caption>Table 51 &mdash; Other transformations</caption>
<thead>
<tr><th>Template</th><th>Condition</th><th>Comments</th></tr>
</thead>
<tbody>
<tr>
<td>
<code>template &lt;std::size_t Len,
std::size_t Align =</code> <var>default-alignment</var><code>&gt;
struct aligned_storage;</code>
</td>
<td>
<code>Len</code> shall not be zero.
<code>Align</code> shall be equal to <code>alignment_of&lt;T&gt;::value</code>
for some type <code>T</code> or to <var>default-alignment</var>.
</td>
<td>
The value of <var>default-alignment</var>
shall be the most stringent alignment requirement for any C++ object type
whose size is no greater than <code>Len</code> (3.9).
The member typedef <code>type</code>
shall be a POD type
suitable for use as uninitialized storage for any object
whose size is at most <code>Len</code>
and whose alignment is a divisor of <code>Align</code>.
</td>
</tr>
<tr>
<td>
<ins><code>template &lt; std::size_t Len, class ... Types &gt;
struct aligned_union;</code></ins>
</td>
<td>
<ins>At least one type is provided.</ins>
</td>
<td>
<ins>The member typedef <code>type</code>
shall be a POD type
suitable for use as uninitialized storage for any object
whose type is listed in <code>Types</code>;
its size shall be at least <code>Len</code>.
The static member <code>alignment_value</code>
shall be an integral constant of type <code>std::size_t</code>
whose value is the strictest alignment of all types
listed in <code>Types</code>.</ins>
</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>


<h3><a name="depr.c.headers">D.5 C standard library headers [depr.c.headers]</a></h3>

<p>
Add <code>&lt;stdalign.h&gt;</code>
to "Table 144 &mdash; C headers".
</p>

</body>
</html>
