8e34673a490cbdf0b3f2edef949e89a4130985ad
[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 C11 (latest free draft
6 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf})
7 sections 6.5.3.4, 6.7.5, 7.15.
8 C++11 (latest free draft
9 @url{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf})
10 section 18.10.
11
12 Gnulib module: stdalign
13
14 Portability problems fixed by Gnulib:
15 @itemize
16 @item
17 This header file is missing on most circa-2011 platforms.
18 @item
19 Clang 3.0's @code{<stdalign.h>} does not define @code{alignof}/@code{_Alignof}.
20 @item
21 The @code{alignof} and @code{_Alignof} macros return too large values for
22 the types @code{double} and @code{long long} in GCC 4.7.0.
23 @end itemize
24
25 Portability problems not fixed by Gnulib:
26 @itemize
27 @item
28 @code{_Alignas} and @code{alignas} are not always supported;
29 on platforms lacking support, the
30 macro @code{__alignas_is_defined} is not defined.
31 Supported compilers include GCC, IBM C, Sun C 5.11 and later,
32 and MSVC 7.0 and later.
33 @item
34 Some compilers do not support alignment via
35 @code{alignas}/@code{_Alignas} of @code{auto} variables (i.e.,
36 variables on the stack).  They diagnose and ignore the alignment: Sun
37 C 5.11.
38 @item
39 Some linkers do not support operands of @code{_Alignas}/@code{alignas}
40 that are greater than 8: mingw.
41 @item
42 Some compilers require the operand of @code{_Alignas}/@code{alignas}
43 to be a single integer constant, not an expression: MSVC 7.0 through
44 at least 10.0.
45 @item
46 The Sun C 5.11 compiler sometimes mishandles the alignment of multiple
47 external variables that are declared close together with
48 @code{_Alignas}/@code{alignas}.  This compiler bug causes the Gnulib
49 module @code{stdalign-tests} to fail.  The Sun Studio Developer Bug
50 Report Review Team assigned the internal review ID 2125432 (dated
51 2011-11-01) to this issue.
52 @item
53 @code{<stdalign.h>} must be #included before @code{_Alignas} and
54 @code{_Alignof} can be used.
55 @item
56 You cannot assume that @code{_Alignas} and @code{_Alignof} are reserved words;
57 they might be macros.
58 @end itemize