stdalign: port better to MSVC and to Sun C 5.11
[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 @end itemize
17
18 Portability problems not fixed by Gnulib:
19 @itemize
20 @item
21 @code{_Alignas} and @code{alignas} are not always supported;
22 on platforms lacking support, the
23 macro @code{__alignas_is_defined} is not defined.
24 Supported compilers include GCC, IBM C, Sun C 5.11 and later,
25 and MSVC 7.0 and later.
26 @item
27 Some compilers do not support alignment via
28 @code{alignas}/@code{_Alignas} of @code{auto} variables (i.e.,
29 variables on the stack).  They diagnose and ignore the alignment: Sun
30 C 5.11.
31 @item
32 Some compilers require the operand of @code{_Alignas}/@code{alignas}
33 to be a single integer constant, not an expression: MSVC 7.0 through
34 at least 10.0.
35 @item
36 The Sun C 5.11 compiler sometimes mishandles the alignment of multiple
37 external variables that are declared close together with
38 @code{_Alignas}/@code{alignas}.  This compiler bug causes the Gnulib
39 module @code{stdalign-tests} to fail.
40 @item
41 @code{<stdalign.h>} must be #included before @samp{_Alignas} and
42 @samp{_Alignof} can be used.
43 @item
44 You cannot assume that @code{_Alignas} and @code{_Alignof} are reserved words;
45 they might be macros.
46 @end itemize