Preprocessor (C/C++) · 2021. 2. 8. · 02 Preprocessor Directives 8. #import #import...

20
Preprocessor (C/C++)

Transcript of Preprocessor (C/C++) · 2021. 2. 8. · 02 Preprocessor Directives 8. #import #import...

  • Preprocessor (C/C++)

  • 222

    1 Preprocessor

    2 Preprocessor directives

    목차

  • 333

    Preprocessor01

    1. Preprocessor 란?

    Preprocessing Compiling Assembling Linking

  • 444

    02 Preprocessor Directives

    1. 전처리기 지시문의 종류

  • 555

    02 Preprocessor Directives

    2. #if #elif #else #endif

    #if [조건1]…

    #elif [조건2]…

    #else

    #endif

    if( [조건1] ){…}

    else if ( [조건2] ){…}

    else

    {…}

    전처리 과정에서 알수 있는 내용을 조건으로 정해야 한다.

  • 666

    02 Preprocessor Directives

    2. #if #elif #else #endif

    ?

    ? =3

  • 777

    02 Preprocessor Directives

    3. #ifdef #ifndef

    identifier

    #if defined(identifier)

    #if !defined(identifier)

    #ifdef identifier

    #ifndef identifier

  • 888

    02 Preprocessor Directives

    3. #ifdef #ifndef

  • 999

    02 Preprocessor Directives

    4. #define #undef

    #define identifier token-string

    #define identifier(identifier,…, identifier) token-string

    #undef identifier

  • 101010

    02 Preprocessor Directives

    4. #define #undef

  • 111111

    02 Preprocessor Directives

    4. #define #undef

    Variadic 매크로로줄임표 위치의 모든인수로 대체 된다.

  • 121212

    02 Preprocessor Directives

    5. #error

    #error token-string

    x64 프로세서에서사용되는 매크로

  • 131313

    02 Preprocessor Directives

    6. #include

    #include “path-spec”

    #include

    1. 소스파일과 동일한 디렉터리 탐색2. include 파일이 열린 반대 순서로 탐색3. 컴파일러 옵션의 지정된 경로를 탐색4. INCLUDE 환경변수가 지정된 경로를 탐색

    1. 컴파일러 옵션의 지정된 경로를 탐색

    2. INCLUDE환경 변수가지정한 경로를 탐색

  • 141414

    02 Preprocessor Directives

    7. #line

    #line digit-sequence [“filename”]

  • 151515

    02 Preprocessor Directives

    7. #line__LINE__ - 현재 소스파일의 줄 번호

    __FILE__ - 현재 소스파일의경로 및 이름

  • 161616

    02 Preprocessor Directives

    8. #import

    #import “filename” [attributes]

    #import [attributes]

    1. 형식 라이브러리를 포함하는 파일2. ProgID(COM/ActiveX 개체를 식별하는 클래스 식별자)3. LibId(형식 라이브러리 ID)4. 실행파일(.exe)5. 라이브러리 리소스를 포함하는 라이브러리 파일(.dll)6. 형식 라이브러리를 보유하는 복함문서

    하나 이상의 #import 특성을 입력 할 수 있다. 여러 특성을 사용할 때는 쉼표를 이용해 구분한다.

  • 171717

    02 Preprocessor Directives

    9. #using

    #using file [as_friend]

    *.dll, *.exe, *.obj 파일

  • 181818

    02 Preprocessor Directives

    10. #pragma

    #pragma token-string

    __pragma(token-string)

  • 191919

    02 Preprocessor Directives

    10. #pragma

    #pragma token-string

    __pragma(token-string)

    alloc_text auto_inline bss_seg check_stack Code_seg

    Comment Component Fenv_access Float_control Fp_contract

    Conform Const_seg Data_seg Deprecated Detect_mismatch

    Function Hdrstop Inlude_alias Init_seg Inline_depth

    Inline_recursion Intrinsic Loop make_public Managed

    Message Omp Once Optimize Pack

    Pointers_to

    _membersPop_macro Push_macro Region Endregion

    Runtime_checks Section Setlocale Strict_gs_check Unmanaged

    Vtordisp warning

  • 202020

    감사합니다.