Files
hustoj/web/cppreference-zh/chmhelp/cpp-keywords.html
2025-08-01 12:57:54 +08:00

203 lines
16 KiB
HTML

<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh">
<head><meta http-equiv="x-ua-compatible" content="ie=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>C++ &#20851;&#38190;&#35789;</title>
<link rel="stylesheet" href="ext.css" />
<link rel="stylesheet" href="site_modules.css" />
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_keyword skin-cppreference2 action-view cpp-navbar">
<div id="cpp-content-base">
<div id="content"><a id="top"></a>
<h1 id="firstHeading" class="firstHeading">C++ &#20851;&#38190;&#35789;</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a></span></div>
<div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr" xml:lang="zh">
<p>&#36825;&#26159; C++ &#20013;&#30340;&#20445;&#30041;&#23383;&#21015;&#34920;&#12290;&#22240;&#20026;&#23427;&#20204;&#20026;&#35821;&#35328;&#25152;&#29992;&#65292;&#25925;&#36825;&#20123;&#20851;&#38190;&#35789;&#19981;&#21487;&#29992;&#20110;&#37325;&#23450;&#20041;&#25110;&#37325;&#36733;&#12290;</p>
<table class="wikitable">
<tr>
<td>
<p><a href="cpp-keyword-alignas.html"><code>alignas</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-alignof.html"><code>alignof</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-and.html"><code>and</code></a><br />
<a href="cpp-keyword-and_eq.html"><code>and_eq</code></a><br />
<a href="cpp-keyword-asm.html"><code>asm</code></a><br />
<a href="cpp-language-transactional_memory.html"><tt>atomic_cancel</tt></a> <span class="t-mark-rev t-since-tm-ts t-mark-ts">(TM TS)</span><br />
<a href="cpp-language-transactional_memory.html"><tt>atomic_commit</tt></a> <span class="t-mark-rev t-since-tm-ts t-mark-ts">(TM TS)</span><br />
<a href="cpp-language-transactional_memory.html"><tt>atomic_noexcept</tt></a> <span class="t-mark-rev t-since-tm-ts t-mark-ts">(TM TS)</span><br />
<a href="cpp-keyword-auto.html"><code>auto</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-bitand.html"><code>bitand</code></a><br />
<a href="cpp-keyword-bitor.html"><code>bitor</code></a><br />
<a href="cpp-keyword-bool.html"><code>bool</code></a><br />
<a href="cpp-keyword-break.html"><code>break</code></a><br />
<a href="cpp-keyword-case.html"><code>case</code></a><br />
<a href="cpp-keyword-catch.html"><code>catch</code></a><br />
<a href="cpp-keyword-char.html"><code>char</code></a><br />
<a href="cpp-keyword-char8_t.html"><code>char8_t</code></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span><br />
<a href="cpp-keyword-char16_t.html"><code>char16_t</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-char32_t.html"><code>char32_t</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-class.html"><code>class</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-compl.html"><code>compl</code></a><br />
<a href="cpp-keyword-concept.html"><code>concept</code></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span><br />
<a href="cpp-keyword-const.html"><code>const</code></a><br />
<a href="cpp-keyword-consteval.html"><code>consteval</code></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span><br />
<a href="cpp-keyword-constexpr.html"><code>constexpr</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-constinit.html"><code>constinit</code></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span><br />
<a href="cpp-keyword-const_cast.html"><code>const_cast</code></a><br />
<a href="cpp-keyword-continue.html"><code>continue</code></a><br />
<a href="cpp-keyword-co_await.html"><code>co_await</code></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span><br />
<a href="cpp-keyword-co_return.html"><code>co_return</code></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span><br />
<a href="cpp-keyword-co_yield.html"><code>co_yield</code></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span><br />
<a href="cpp-keyword-decltype.html"><code>decltype</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br /></p>
</td>
<td>
<p><a href="cpp-keyword-default.html"><code>default</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-delete.html"><code>delete</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-do.html"><code>do</code></a><br />
<a href="cpp-keyword-double.html"><code>double</code></a><br />
<a href="cpp-keyword-dynamic_cast.html"><code>dynamic_cast</code></a><br />
<a href="cpp-keyword-else.html"><code>else</code></a><br />
<a href="cpp-keyword-enum.html"><code>enum</code></a><br />
<a href="cpp-keyword-explicit.html"><code>explicit</code></a><br />
<a href="cpp-keyword-export.html"><code>export</code></a><span class="t-mark">(1)</span><span class="t-mark">(3)</span><br />
<a href="cpp-keyword-extern.html"><code>extern</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-false.html"><code>false</code></a><br />
<a href="cpp-keyword-float.html"><code>float</code></a><br />
<a href="cpp-keyword-for.html"><code>for</code></a><br />
<a href="cpp-keyword-friend.html"><code>friend</code></a><br />
<a href="cpp-keyword-goto.html"><code>goto</code></a><br />
<a href="cpp-keyword-if.html"><code>if</code></a><br />
<a href="cpp-keyword-inline.html"><code>inline</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-int.html"><code>int</code></a><br />
<a href="cpp-keyword-long.html"><code>long</code></a><br />
<a href="cpp-keyword-mutable.html"><code>mutable</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-namespace.html"><code>namespace</code></a><br />
<a href="cpp-keyword-new.html"><code>new</code></a><br />
<a href="cpp-keyword-noexcept.html"><code>noexcept</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-not.html"><code>not</code></a><br />
<a href="cpp-keyword-not_eq.html"><code>not_eq</code></a><br />
<a href="cpp-keyword-nullptr.html"><code>nullptr</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-operator.html"><code>operator</code></a><br />
<a href="cpp-keyword-or.html"><code>or</code></a><br />
<a href="cpp-keyword-or_eq.html"><code>or_eq</code></a><br />
<a href="cpp-keyword-private.html"><code>private</code></a><br />
<a href="cpp-keyword-protected.html"><code>protected</code></a><br />
<a href="cpp-keyword-public.html"><code>public</code></a><br />
<a href="cpp-keyword-reflexpr.html"><code>reflexpr</code></a> <span class="t-mark-rev t-since-reflection-ts t-mark-ts">(&#21453;&#23556; TS)</span><br /></p>
</td>
<td>
<p><a href="cpp-keyword-register.html"><code>register</code></a><span class="t-mark">(2)</span><br />
<a href="cpp-keyword-reinterpret_cast.html"><code>reinterpret_cast</code></a><br />
<a href="cpp-keyword-requires.html"><code>requires</code></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span><br />
<a href="cpp-keyword-return.html"><code>return</code></a><br />
<a href="cpp-keyword-short.html"><code>short</code></a><br />
<a href="cpp-keyword-signed.html"><code>signed</code></a><br />
<a href="cpp-keyword-sizeof.html"><code>sizeof</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-static.html"><code>static</code></a><br />
<a href="cpp-keyword-static_assert.html"><code>static_assert</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-static_cast.html"><code>static_cast</code></a><br />
<a href="cpp-keyword-struct.html"><code>struct</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-switch.html"><code>switch</code></a><br />
<a href="cpp-language-transactional_memory.html"><tt>synchronized</tt></a> <span class="t-mark-rev t-since-tm-ts t-mark-ts">(TM TS)</span><br />
<a href="cpp-keyword-template.html"><code>template</code></a><br />
<a href="cpp-keyword-this.html"><code>this</code></a><br />
<a href="cpp-keyword-thread_local.html"><code>thread_local</code></a> <span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-keyword-throw.html"><code>throw</code></a><br />
<a href="cpp-keyword-true.html"><code>true</code></a><br />
<a href="cpp-keyword-try.html"><code>try</code></a><br />
<a href="cpp-keyword-typedef.html"><code>typedef</code></a><br />
<a href="cpp-keyword-typeid.html"><code>typeid</code></a><br />
<a href="cpp-keyword-typename.html"><code>typename</code></a><br />
<a href="cpp-keyword-union.html"><code>union</code></a><br />
<a href="cpp-keyword-unsigned.html"><code>unsigned</code></a><br />
<a href="cpp-keyword-using.html"><code>using</code></a><span class="t-mark">(1)</span><br />
<a href="cpp-keyword-virtual.html"><code>virtual</code></a><br />
<a href="cpp-keyword-void.html"><code>void</code></a><br />
<a href="cpp-keyword-volatile.html"><code>volatile</code></a><br />
<a href="cpp-keyword-wchar_t.html"><code>wchar_t</code></a><br />
<a href="cpp-keyword-while.html"><code>while</code></a><br />
<a href="cpp-keyword-xor.html"><code>xor</code></a><br />
<a href="cpp-keyword-xor_eq.html"><code>xor_eq</code></a></p>
</td>
</tr>
</table>
<ul>
<li>(1) - C++11 &#20013;&#21547;&#20041;&#25913;&#21464;&#25110;&#28155;&#21152;&#26032;&#21547;&#20041;&#12290;</li>
<li>(2) - C++17 &#20013;&#21547;&#20041;&#25913;&#21464;&#12290;</li>
<li>(3) - C++20 &#20013;&#21547;&#20041;&#25913;&#21464;&#12290;</li>
</ul>
<p>&#27880;&#24847; <a href="cpp-keyword-and.html"><code>and</code></a>&#12289;<a href="cpp-keyword-bitor.html"><code>bitor</code></a>&#12289;<a href="cpp-keyword-or.html"><code>or</code></a>&#12289;<a href="cpp-keyword-xor.html"><code>xor</code></a>&#12289;<a href="cpp-keyword-compl.html"><code>compl</code></a>&#12289;<a href="cpp-keyword-bitand.html"><code>bitand</code></a>&#12289;<a href="cpp-keyword-and_eq.html"><code>and_eq</code></a>&#12289;<a href="cpp-keyword-or_eq.html"><code>or_eq</code></a>&#12289;<a href="cpp-keyword-xor_eq.html"><code>xor_eq</code></a>&#12289;<a href="cpp-keyword-not.html"><code>not</code></a> &#21450; <a href="cpp-keyword-not_eq.html"><code>not_eq</code></a>&#65288;&#36824;&#26377;&#21452;&#26631;&#31526; <code>&lt;%</code>&#12289;<code>%&gt;</code>&#12289;<code>&lt;:</code>&#12289;<code>:&gt;</code>&#12289;<code>%:</code> &#21450; <code>%:%:</code>&#65289;&#25552;&#20379;<a href="cpp-language-operator_alternative.html">&#26631;&#20934;&#35760;&#21495;&#30340;&#20195;&#29992;&#34920;&#31034;&#26041;&#27861;</a>&#12290;</p>
<p>&#38500;&#20102;&#20851;&#38190;&#35789;&#22806;&#65292;&#36824;&#26377;<i>&#25317;&#26377;&#29305;&#27530;&#21547;&#20041;&#30340;&#26631;&#35782;&#31526;</i>&#65292;&#23427;&#20204;&#21487;&#29992;&#20316;&#23545;&#35937;&#25110;&#20989;&#25968;&#30340;&#21517;&#23383;&#65292;&#20294;&#22312;&#26576;&#20123;&#35821;&#22659;&#25317;&#26377;&#29305;&#27530;&#21547;&#20041;&#12290;</p>
<table class="wikitable">
<tr>
<td>
<p><a href="cpp-language-override.html"><tt>override</tt></a> <span class="t-mark-rev t-since-cxx11">(C++11)</span><br />
<a href="cpp-language-final.html"><tt>final</tt></a> <span class="t-mark-rev t-since-cxx11">(C++11)</span><br />
<a href="cpp-keyword-import.html"><code>import</code></a> <span class="t-mark-rev t-since-cxx20">(C++20)</span><br />
<a href="https://zh.cppreference.com/mwiki/index.php?title=cpp/keyword/module&amp;action=edit&amp;redlink=1" class="new" title="cpp/keyword/module&#65288;&#39029;&#38754;&#19981;&#23384;&#22312;&#65289;"><code>module</code></a> <span class="t-mark-rev t-since-cxx20">(C++20)</span><br />
<a href="cpp-language-transactional_memory.html"><tt>transaction_safe</tt></a> <span class="t-mark-rev t-since-tm-ts t-mark-ts">(TM TS)</span><br />
<a href="cpp-language-transactional_memory.html"><tt>transaction_safe_dynamic</tt></a> <span class="t-mark-rev t-since-tm-ts t-mark-ts">(TM TS)</span></p>
</td>
</tr>
</table>
<p>&#36824;&#26377;&#65292;&#22312;&#20219;&#20309;&#20301;&#32622;&#21547;&#21452;&#19979;&#21010;&#32447; __ &#30340;&#25152;&#26377;<a href="cpp-language-identifiers.html">&#26631;&#35782;&#31526;</a>&#65292;&#21644;&#20197;&#19968;&#20010;&#19979;&#21010;&#32447;&#21518;&#38543;&#19968;&#20010;&#22823;&#20889;&#23383;&#27597;&#24320;&#22987;&#30340;&#25152;&#26377;&#26631;&#35782;&#31526;&#65292;&#37117;&#22987;&#32456;&#21463;&#20445;&#30041;&#65292;&#32780;&#25152;&#26377;&#20197;&#21333;&#19979;&#21010;&#32447;&#24320;&#22987;&#30340;&#26631;&#35782;&#31526;&#65292;&#20445;&#30041;&#29992;&#20316;&#20840;&#23616;&#21629;&#21517;&#31354;&#38388;&#20013;&#30340;&#21517;&#31216;&#12290;&#26356;&#22810;&#32454;&#33410;&#35265;<a href="cpp-language-identifiers.html">&#26631;&#35782;&#31526;</a>&#12290;</p>
<p>&#21629;&#21517;&#31354;&#38388; <code>std</code> &#29992;&#20110;&#25918;&#32622;&#26631;&#20934; C++ &#24211;&#20013;&#30340;&#21517;&#31216;&#12290;&#20851;&#20110;&#21521;&#23427;&#28155;&#21152;&#21517;&#31216;&#30340;&#35268;&#21017;&#65292;&#35265;<a href="cpp-language-extending_std.html">&#25193;&#20805;&#21629;&#21517;&#31354;&#38388; std</a> &#12290;</p>
<table class="t-rev-begin">
<tr class="t-rev t-since-cxx11">
<td>
<p>&#21517;&#31216; <code>posix</code> &#20445;&#30041;&#20316;&#20026;&#26410;&#26469;&#30340;&#39030;&#32423;&#21629;&#21517;&#31354;&#38388;&#12290;&#33509;&#31243;&#24207;&#20110;&#35813;&#21629;&#21517;&#31354;&#38388;&#22768;&#26126;&#25110;&#23450;&#20041;&#20219;&#20309;&#20869;&#23481;&#65292;&#21017;&#34892;&#20026;&#26410;&#23450;&#20041;&#12290;</p>
</td>
<td><span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span></td>
</tr>
</table>
<p><a href="cpp-preprocessor.html">&#39044;&#22788;&#29702;&#22120;</a>&#22312;&#39044;&#22788;&#29702;&#25351;&#20196;&#30340;&#35821;&#22659;&#20013;&#35782;&#21035;&#19979;&#21015;&#35760;&#21495;&#65306;</p>
<table class="wikitable">
<tr>
<td>
<p><a href="cpp-preprocessor-conditional.html"><tt>if</tt></a><br />
<a href="cpp-preprocessor-conditional.html"><tt>elif</tt></a><br />
<a href="cpp-preprocessor-conditional.html"><tt>else</tt></a><br />
<a href="cpp-preprocessor-conditional.html"><tt>endif</tt></a><br /></p>
</td>
<td>
<p><a href="cpp-preprocessor-conditional.html"><tt>ifdef</tt></a><br />
<a href="cpp-preprocessor-conditional.html"><tt>ifndef</tt></a><br />
<a href="cpp-preprocessor-replace.html"><tt>define</tt></a><br />
<a href="cpp-preprocessor-replace.html"><tt>undef</tt></a><br /></p>
</td>
<td>
<p><a href="cpp-preprocessor-include.html"><tt>include</tt></a><br />
<a href="cpp-preprocessor-line.html"><tt>line</tt></a><br />
<a href="cpp-preprocessor-error.html"><tt>error</tt></a><br />
<a href="cpp-preprocessor-impl.html"><tt>pragma</tt></a><br /></p>
</td>
<td>
<p><a href="cpp-preprocessor-conditional.html"><tt>defined</tt></a><br />
<a href="cpp-feature_test.html"><tt>__has_include</tt></a> <span class="t-mark-rev t-since-cxx17">(C++17 &#36215;)</span><br />
<a href="cpp-feature_test.html"><tt>__has_cpp_attribute</tt></a> <span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span></p>
</td>
<td>
<p><a href="cpp-keyword-export.html"><code>export</code></a> <span class="t-mark-rev t-since-cxx20">(C++20)</span><br />
<a href="cpp-keyword-import.html"><code>import</code></a> <span class="t-mark-rev t-since-cxx20">(C++20)</span><br />
<a href="https://zh.cppreference.com/mwiki/index.php?title=cpp/keyword/module&amp;action=edit&amp;redlink=1" class="new" title="cpp/keyword/module&#65288;&#39029;&#38754;&#19981;&#23384;&#22312;&#65289;"><code>module</code></a> <span class="t-mark-rev t-since-cxx20">(C++20)</span></p>
</td>
</tr>
</table>
<p>&#39044;&#22788;&#29702;&#22120;&#22312;&#39044;&#22788;&#29702;&#25351;&#20196;&#30340;&#35821;&#22659;<i>&#20043;&#22806;</i>&#35782;&#21035;&#19979;&#21015;&#35760;&#21495;&#65306;</p>
<table class="wikitable">
<tr>
<td>
<p><a href="cpp-preprocessor-impl.html"><tt>_Pragma</tt></a><span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span></p>
</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">&#21442;&#38405;</span></h3>
<table class="t-dsc-begin"></table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>