Share via


C++ 키워드

키워드는 특별한 의미가 있는 미리 정의된 예약된 식별자입니다. 따라서 프로그램에서 키워드를 식별자로 사용할 수 없습니다. 다음 키워드는 Microsoft C++에서 예약되었습니다. 밑줄이 앞에 오는 이름은 Microsoft 확장입니다.

__abstract 2

__alignof 연산자

__asm

__assume

__based

__box 2

__cdecl

__declspec

__delegate 2

__event

__except

__fastcall

__finally

__forceinline

__gc 2

__hook 3

__identifier

__if_exists

__if_not_exists

__inline

__int16

__int32

__int64

__int8

__interface

__leave

__m128

__m128d

__m128i

__m64

__multiple_inheritance

__nogc 2

__noop

__pin 2

__property 2

__raise

__sealed 2

__single_inheritance

__stdcall

__super

__thiscall

__try/__except, __try/__finally

__try_cast 2

__unaligned

__unhook 3

__uuidof

__value 2

__virtual_inheritance

__w64

__wchar_t, wchar_t

abstract

array

auto

bool

break

case

catch

char

클래스(class)

const

const_cast

continue

decltype

default

대리자(delegate)

삭제

deprecated 1

dllexport 1

dllimport 1

do

double

dynamic_cast

else

enum

enum class

enum struct

이벤트(event)

명시적

extern

false

finally

float

for

for each, in

friend

friend_as

gcnew

generic

goto

if

initonly

inline

int

interface class

interface struct

interior_ptr

literal

long

mutable

naked 1

namespace

new

new

noinline 1

noreturn 1

nothrow 1

novtable 1

nullptr

연산자

private

속성

property 1

protected

public

ref class

ref struct

register

reinterpret_cast

return

safecast

sealed

selectany 1

short

signed

sizeof

static

static_assert

static_cast

struct

switch

template

this

thread 1

throw

true

try

형식 정의

typeid

typeid

typename

union

unsigned

using declaration, using directive

uuid 1

value class

value struct

virtual

void

volatile

while

1   __declspec 키워드의 확장 특성입니다.

2   Managed Extensions for C++에만 적용 가능합니다. 이 구문은 이제 사용되지 않습니다.

3   이벤트 처리에서 사용되는 내장 함수입니다.

자세한 내용은 CLR을 대상으로 하는 언어 기능를 참조하십시오.

Microsoft 전용

Microsoft C++에서 두 개의 밑줄이 앞에 오는 식별자는 컴파일러 구현용으로 예약되었습니다. 따라서 Microsoft 규칙은 Microsoft 관련 키워드 앞에 두 개의 밑줄을 붙이는 것입니다. 이들 단어는 식별자 이름으로 사용할 수 없습니다.

Microsoft 확장은 기본적으로 사용하도록 설정됩니다. 프로그램이 완전히 이식 가능하도록 하려면 컴파일하는 동안 ANSI 호환 /Za 명령줄 옵션(ANSI 호환을 위한 컴파일)을 지정하여 Microsoft 확장을 사용하지 않도록 설정할 수 있습니다. 이렇게 하면 Microsoft 관련 키워드를 사용할 수 없습니다.

Microsoft 확장을 사용하도록 설정한 경우 Microsoft 관련 키워드를 프로그램에서 사용할 수 있습니다. ANSI 규격에 따라 이러한 키워드에는 두 개의 밑줄이 앞에 옵니다. 이전 버전과의 호환성을 위해 __except, __finally, __leave 및 __try를 제외하고 두 개의 밑줄이 붙은 모든 키워드의 한 개의 밑줄이 붙은 버전이 지원됩니다. 또한 앞의 밑줄 없이 __cdecl을 사용할 수 있습니다.

__asm 키워드는 C++ asm 구문을 대체합니다. asm은 다른 C++ 구현과의 호환성을 위해 예약되었지만 구현되지는 않았으므로 __asm을 사용하십시오.

__based 키워드의 경우 32 비트 및 64 비트 대상 컴파일에서 제한적으로 사용됩니다.

참고 항목

참조

어휘 규칙

C++ 연산자