Talk:cpp/language/alignof

"returns alignment". What is "alignment" ? This is totally unclear...


 * I've added a short description and a link to wikipedia for further reading. Hopefully, this will be enough for basic understanding what alignment is. P12 12:30, 13 June 2013 (PDT)


 * As cpp/language gets expanded, we should probably add a page on alignment requirement, fundamental alignment, extended alignment and their properties (e.g. already-mentioned restrictions on reinterpret_cast). --Cubbi 12:36, 13 June 2013 (PDT)

In this example:

struct alignas(1) Double { double d;        };

specified alignas(1) is weaker than natural alignment of double. This contradicts to the text: "If the strictest (largest) alignas on a declaration is weaker than the alignment it would have without any alignas specifiers (that is, weaker than its natural alignment or weaker than alignas on another declaration of the same object or type), the program is ill-formed"

--ddbug 12:36, 29 Apr 2016 (PDT)
 * indeed it is ill-formed. clang says

{{source|1= prog.cc:13:8: error: requested alignment is less than minimum alignment of 8 for type 'Double' struct alignas(1) Double { ^ }}. fixing.. --Cubbi (talk) 13:40, 29 April 2016 (PDT)