Merge branch 'stable'
[gnulib.git] / doc / posix-headers / stdalign.texi
1 @node stdalign.h
2 @section @file{stdalign.h}
3
4 POSIX specification:@* Not in POSIX yet, but we expect it will be.
5 ISO C1X @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf}
6 sections 6.5.3.4, 6.7.5, 7.15.
7 C++0X @url{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf}
8 section 18.10.
9
10 Gnulib module: stdalign
11
12 Portability problems fixed by Gnulib:
13 @itemize
14 @item
15 This header file is missing on most circa-2011 platforms.
16 @item
17 Clang 3.0's @code{<stdalign.h>} does not define @code{alignof}/@code{_Alignof}.
18 @end itemize
19
20 Portability problems not fixed by Gnulib:
21 @itemize
22 @item
23 @code{_Alignas} and @code{alignas} are not always supported;
24 on platforms lacking support, the
25 macro @code{__alignas_is_defined} is not defined.
26 Supported compilers include GCC, IBM C, Sun C 5.11 and later,
27 and MSVC 7.0 and later.
28 @item
29 Some compilers do not support alignment via
30 @code{alignas}/@code{_Alignas} of @code{auto} variables (i.e.,
31 variables on the stack).  They diagnose and ignore the alignment: Sun
32 C 5.11.
33 @item
34 Some linkers do not support operands of @code{_Alignas}/@code{alignas}
35 that are greater than 8: mingw.
36 @item
37 Some compilers require the operand of @code{_Alignas}/@code{alignas}
38 to be a single integer constant, not an expression: MSVC 7.0 through
39 at least 10.0.
40 @item
41 The Sun C 5.11 compiler sometimes mishandles the alignment of multiple
42 external variables that are declared close together with
43 @code{_Alignas}/@code{alignas}.  This compiler bug causes the Gnulib
44 module @code{stdalign-tests} to fail.  The Sun Studio Developer Bug
45 Report Review Team assigned the internal review ID 2125432 (dated
46 2011-11-01) to this issue.
47 @item
48 @code{<stdalign.h>} must be #included before @samp{_Alignas} and
49 @samp{_Alignof} can be used.
50 @item
51 You cannot assume that @code{_Alignas} and @code{_Alignof} are reserved words;
52 they might be macros.
53 @end itemize