<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=Stdalign.h</id>
	<title>Stdalign.h - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=Stdalign.h"/>
	<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=Stdalign.h&amp;action=history"/>
	<updated>2026-07-04T13:36:34Z</updated>
	<subtitle>在这个wiki上该页的修订历史</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://arolstar52-zhtest.hf.space/index.php?title=Stdalign.h&amp;diff=2151476&amp;oldid=prev</id>
		<title>imported&gt;AnYiLin：​source标签已被弃用</title>
		<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=Stdalign.h&amp;diff=2151476&amp;oldid=prev"/>
		<updated>2021-03-20T02:53:31Z</updated>

		<summary type="html">&lt;p&gt;source标签已被弃用&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{lowercase|title=stdalign.h}}&lt;br /&gt;
{{C_Standard_library}} &amp;lt;!-- to edit this template go to [[template:C_Standard_library]] --&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;stdalign.h&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039;是C语言标准2011版新增加的[[C標準函数庫]][[头文件]]，为向后兼容目的定义了4个宏：&lt;br /&gt;
*alignas  被扩展为_Alignas，_Alignas为C11的关键字。&lt;br /&gt;
*alignof  被扩展为_Alignof，_Alignof为C11的关键字。&lt;br /&gt;
*__alignas_is_defined 被扩展为1&lt;br /&gt;
*__alignof_is_defined 被扩展为1&lt;br /&gt;
&lt;br /&gt;
在C++11中，alignas与alignof是关键字。alignas用于变量定义、数据成员声明、class\struct\union的声明与定义。alignas不可用于基本类型的别名、数组类型等。alignas只能用于更严格（更大对齐值）。alignas的参数可以为数、类型。&lt;br /&gt;
&lt;br /&gt;
alignof的参数为类型。&lt;br /&gt;
&lt;br /&gt;
==例子==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdalign.h&amp;gt;&lt;br /&gt;
char alignas(double) buf[30];&lt;br /&gt;
char alignas(32) foo[7];&lt;br /&gt;
&lt;br /&gt;
typedef struct { int a; double b; } S;&lt;br /&gt;
// alignof(S) == 8 为真&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==参考文献==&lt;br /&gt;
* C语言标准2011版：ISO/IEC 9899:2011第7.15节“Alignment &amp;lt;stdalign.h&amp;gt;”。&lt;br /&gt;
&lt;br /&gt;
{{reflist}}&lt;br /&gt;
[[Category:C標準函式庫|V]]&lt;/div&gt;</summary>
		<author><name>imported&gt;AnYiLin</name></author>
	</entry>
</feed>