For faster navigation, this Iframe is preloading the Wikiwand page for
stdalign.h.
stdalign.h
是C语言标准2011版新增加的C标准函数库头文件,为向后兼容目的定义了4个宏:
- alignas 被扩展为_Alignas,_Alignas为C11的关键字。
- alignof 被扩展为_Alignof,_Alignof为C11的关键字。
- __alignas_is_defined 被扩展为1
- __alignof_is_defined 被扩展为1
在C++11中,alignas与alignof是关键字。alignas用于变量定义、数据成员声明、class\struct\union的声明与定义。alignas不可用于基本类型的别名、数组类型等。alignas只能用于更严格(更大对齐值)。alignas的参数可以为数、类型。
alignof的参数为类型。
#include <stdalign.h>
char alignas(double) buf[30];
char alignas(32) foo[7];
typedef struct { int a; double b; } S;
// alignof(S) == 8 为真
- C语言标准2011版:ISO/IEC 9899:2011第7.15节“Alignment <stdalign.h>”。
{{bottomLinkPreText}}
{{bottomLinkText}}
This page is based on a Wikipedia article written by
contributors (read/edit).
Text is available under the
CC BY-SA 4.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.
{{current.index+1}} of {{items.length}}
Thanks for reporting this video!
This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:
An extension you use may be preventing Wikiwand articles from loading properly.
If you're using HTTPS Everywhere or you're unable to access any article on Wikiwand, please consider switching to HTTPS (https://www.wikiwand.com).
An extension you use may be preventing Wikiwand articles from loading properly.
If you are using an Ad-Blocker, it might have mistakenly blocked our content.
You will need to temporarily disable your Ad-blocker to view this page.
✕
This article was just edited, click to reload
Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}
Follow Us
Don't forget to rate us
Oh no, there's been an error
Please help us solve this error by emailing us at
support@wikiwand.com
Let us know what you've done that caused this error, what browser you're using, and whether you have any special extensions/add-ons installed.
Thank you!