C++ キーワードKeywords (C++)
キーワードは、特別な意味を持つ定義済みおよび予約済みの識別子です。Keywords are predefined reserved identifiers that have special meanings. プログラムで識別子として使用することはできません。They can't be used as identifiers in your program. 次のキーワードは Microsoft C++ 用に予約されています。The following keywords are reserved for Microsoft C++. 先頭にアンダースコアが付いていて、C++/CX および C++/CLI に指定された名前は Microsoft 拡張機能です。Names with leading underscores and names specified for C++/CX and C++/CLI are Microsoft extensions.
標準 C++ のキーワードStandard C++ keywords
alignas
alignof
and
band
b
and_eq
band_eq
b
asm
aasm
a
auto
bitand
bbitand
b
bitor
bbitor
b
bool
break
case
catch
char
char8_t
cchar8_t
c
char16_t
char32_t
class
compl
bcompl
b
concept
cconcept
c
const
const_cast
consteval
cconsteval
c
constexpr
constinit
cconstinit
c
continue
co_await
cco_await
c
co_return
cco_return
c
co_yield
cco_yield
c
decltype
default
delete
do
double
dynamic_cast
else
enum
explicit
export
cexport
c
extern
false
float
for
friend
goto
if
inline
Microsoft 固有のキーワード を指定すると、 __asm
C++ の構文が置き換えら asm
れます。a The Microsoft-specific __asm
keyword replaces C++ asm
syntax. asm
は、他の C++ 実装との互換性のために予約されていますが、実装されていません。asm
is reserved for compatibility with other C++ implementations, but not implemented. __asm
X86 ターゲットでインラインアセンブリに使用します。Use __asm
for inline assembly on x86 targets. Microsoft C++ では、他のターゲットのインラインアセンブリはサポートされていません。Microsoft C++ doesn't support Inline assembly for other targets.
b拡張演算子のシノニムは、 /permissive-
/Za
( 言語拡張を無効にしたときのキーワードです。b The extended operator synonyms are keywords when /permissive-
or /Za
(Disable language extensions) is specified. Microsoft 拡張機能が有効になっている場合、キーワードはキーワードではありません。They aren't keywords when Microsoft extensions are enabled.
c /std:c++latest
は、が指定されている場合にサポートされます。c Supported when /std:c++latest
is specified.
Microsoft 固有の C++ キーワードMicrosoft-specific C++ keywords
C++ では、2つの連続するアンダースコアを含む識別子は、コンパイラの実装用に予約されています。In C++, identifiers that contain two consecutive underscores are reserved for compiler implementations. Microsoft の規約では、Microsoft 固有のキーワードの前に2つのアンダースコアが付いています。The Microsoft convention is to precede Microsoft-specific keywords with double underscores. これらの単語を識別子名として使用することはできません。These words can't be used as identifier names.
Microsoft 拡張機能は既定で有効になっています。Microsoft extensions are enabled by default. プログラムが完全に移植可能であることを確認するに /permissive-
は、コンパイル時に [ /Za
( 言語拡張機能の無効化] オプションを指定して Microsoft 拡張機能を無効にすることができます。To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the /permissive-
or /Za
(Disable language extensions) option during compilation. これらのオプションでは、一部の Microsoft 固有のキーワードが無効になります。These options disable some Microsoft-specific keywords.
Microsoft 拡張機能を有効にすると、Microsoft 固有のキーワードをプログラム内で使用できます。When Microsoft extensions are enabled, you can use the Microsoft-specific keywords in your programs. ANSI 準拠のために、これらのキーワードは 2 つのアンダースコアで始まります。For ANSI compliance, these keywords are prefaced by a double underscore. 旧バージョンとの互換性のために、多くの下線付きキーワードの1つのアンダースコアバージョンがサポートされています。For backward compatibility, single-underscore versions of many of the double-underscored keywords are supported. __cdecl
キーワードは、先頭にアンダースコアがない場合に使用できます。The __cdecl
keyword is available with no leading underscore.
__asm
キーワードは C++ の構文に代わるもの asm
です。The __asm
keyword replaces C++ asm
syntax. asm
は、他の C++ 実装との互換性のために予約されていますが、実装されていません。asm
is reserved for compatibility with other C++ implementations, but not implemented. __asm
を使用します。Use __asm
.
キーワードの使用は、 __based
32 ビットおよび64ビットのターゲットコンパイルの場合に限られます。The __based
keyword has limited uses for 32-bit and 64-bit target compilations.
__alignof
e__alignof
e
__asm
e__asm
e
__assume
e__assume
e
__based
e__based
e
__cdecl
e__cdecl
e
__declspec
e__declspec
e
__event
__except
e__except
e
__fastcall
e__fastcall
e
__finally
e__finally
e
__forceinline
e__forceinline
e
__hook
d__hook
d
__if_exists
__if_not_exists
__inline
e__inline
e
__int16
e__int16
e
__int32
e__int32
e
__int64
e__int64
e
__int8
e__int8
e
__interface
__leave
e__leave
e
__m128
イベント処理で使用されるd組み込み関数。d Intrinsic function used in event handling.
e 以前のバージョンとの下位互換性を維持するために、これらのキーワードは、Microsoft 拡張機能が有効になっている場合 (既定)、2つの先頭のアンダースコアと1つの先頭にアンダースコアが使用されます。e For backward compatibility with previous versions, these keywords are available both with two leading underscores and a single leading underscore when Microsoft extensions are enabled (the default).
__Declspec 修飾子内の Microsoft キーワードMicrosoft keywords in __declspec modifiers
これらの識別子は、修飾子の拡張属性です __declspec
。These identifiers are extended attributes for the __declspec
modifier. これらは、そのコンテキスト内のキーワードと見なされます。They're considered keywords within that context.
C++/CLI および C++/CX キーワードC++/CLI and C++/CX keywords
__abstract
f__abstract
f
__box
f__box
f
__delegate
f__delegate
f
__gc
f__gc
f
__identifier
__nogc
f__nogc
f
__noop
__pin
f__pin
f
__property
f__property
f
__sealed
f__sealed
f
__try_cast
f__try_cast
f
__value
f__value
f
abstract
gabstract
g
array
garray
g
as_friend
delegate
gdelegate
g
enum class
enum struct
event
gevent
g
f Managed Extensions for C++ にのみ適用されます。f Applicable to Managed Extensions for C++ only. この構文は現在非推奨とされます。This syntax is now deprecated. 詳細については、「Component Extensions for Runtime Platforms」を参照してください。For more information, see Component Extensions for Runtime Platforms.
C++/CLI に適用されるgg Applicable to C++/CLI.
関連項目See also
構文規則Lexical conventions
C++ の組み込み演算子、優先順位、および結合規則C++ built-in operators, precedence, and associativity