stdalign.h
==========

POSIX specification:
 Not in POSIX yet, but we expect it will be, at least temporarily until it becomes obsolete due to its phasing out starting in C23. ISO C23 (latest free draft http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf) sections 6.5.3.4, 6.7.5, 7.15. C++11 (latest free draft http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf) section 18.10.

Gnulib module: alignasof

Portability problems fixed by Gnulib:

  * On older C platforms <stdalign.h> must be included before using alignas or alignof.  For example, GCC versions before 13 do not support these keywords, which were standardized by C23. On C23 and later platforms, <stdalign.h> has no effect and need not be included.  (Gnulib-using code should not include <stdalign.h> without also employing Gnulib's now-deprecated stdalign module.)

  * This header file is missing on many platforms: FreeBSD 6.4, NetBSD 7.1, OpenBSD 6.7, Minix 3.3.0, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, mingw, MSVC 14, Android 9.0.

  * Clang 3.0's <stdalign.h> does not define alignof.

  * The alignof macro returns too large values for the types double and long long in GCC 4.7.0.

  * Older C platforms might not support the obsolescent _Alignas and _Alignof keywords or macros. This portability problem should not matter with code using this module, as such code should use alignas and alignof instead.

  * In C11 and C17, <stdalign.h> defines the macros __alignas_is_defined and __alignof_is_defined to 1. In C23, these macros are not defined. This portability problem should not matter with code using Gnulib's alignasof module, as such code should use alignas and alignof without checking these two macros.  (Gnulib's now-deprecated stdalign module defines these two macros.)

Portability problems not fixed by Gnulib:

  * In C11 and later, the operand of alignof must be a parenthesized type.  Recent versions of GCC support an extension in which the operand can also be a unary expression, as with sizeof.  The Gnulib substitute does not support this extension.

  * On most pre-C11 platforms, the operand of alignof cannot be a structure type containing a flexible array member.

  * The alignas keyword or macro is not always supported. Supported compilers include any compiler supporting C11 or later, which includes GCC, IBM C, Sun C 5.9 and later, and MSVC 7.0 and later.

  * Some compilers do not support alignment via alignas of auto variables (i.e., variables on the stack).  They diagnose and ignore the alignment: Sun C 5.11.

  * Some linkers do not support operands of alignas that are greater than 8: mingw.

  * Some compilers require the operand of alignas to be a single integer constant, not an expression: MSVC 7.0 through at least 10.0.

  * The Sun C 5.13 (2014) compiler sometimes mishandles the alignment of multiple external variables that are declared close together with alignas.  The bug is fixed in Sun C 5.15, also known as Oracle Developer Studio 12.6 (2017).

  * You cannot assume that alignas and alignof are reserved words; they might be macros.