pragma ¶
Each implementation of C and C++ supports some features unique to its host machine or operating system. Some programs, for instance, need to exercise precise control over the memory areas where data is placed or to control the way certain functions receive parameters. The #pragma directives offer a way for each compiler to offer machine- and operating-system-specific features while retaining overall compatibility with the C and C++ languages. Pragmas are machine- or operating-system-specific by definition, and are usually different for every compiler.
-- MSDN
C μ C++ μ ꡬνν κ°κ°μ μ»΄νμΌλ¬μλ ν¬ν
λ νλμ¨μ΄λ OS μ μμ‘΄μ μΈ λͺλͺκ°μ§λ€μ κΈ°λ₯μ κ°μ§κ³ μλ€. μΌλ‘λ‘ λͺλͺμ νλ‘κ·Έλ¨λ€μ λ©λͺ¨λ¦¬μ λ°μ΄ν°κ° μ΄λ ν λ°©μμΌλ‘ μ리μ‘μ κ²μΈμ§ μ κ΄ν λ¬Έμ λ ν¨μκ° νλΌλ―Έν°λ€μ μ‘°μνλ λ°©λ²λ€μ λν μΈλ°ν μ‘°μμ΄ μꡬλλ€. #pragma μ§μμ΄λ€μ C μ C++ μΈμ΄ μμμ μ΅μνμ νΈνμ±μ μ μ§μν€λ©° κ·Έλ¬ν μμ€ν
μμ‘΄μ μΈ λͺ
λ Ήμ΄λ€μ μΈμ΄μ κΈ°λ₯μΌλ‘μ ν¬ν¨μν€λ μΌμ νλ€. Pragma μ§μμ΄λ€μ μΌλ°μ μΌλ‘ μ»΄νμΌλ¬λ€ λ§λ€ μλ‘ λ€λ₯΄λ€.
snowflowerλ Accelerated C++ μ μλ mapμμ λ₯Ό Visual C++μμ μΉλ©΄μ μμ²λ μμ κ²½κ³ λ₯Ό κ²½ννλ€. μ΄κ²μ μ΄λ»κ² ν μ μμκΉ μλ£λ₯Ό μ°Ύλ μ€ λ€μκ³Ό κ°μ λ°©λ²μ μ°Ύμλ€.
mapμμ λλ κ²½κ³ λ λ²νΈ C4786λ²κ³Ό C4788λ²(identifierκ° λ무 κΈΈμ΄μ λνλλ κ²½κ³ λΌκ³ νλ€) λ¨ 2κ° λΏμμ μμκ³ , κ²°κ΅ μμ€μ 맨 μμ€μ
mapμμ λλ κ²½κ³ λ λ²νΈ C4786λ²κ³Ό C4788λ²(identifierκ° λ무 κΈΈμ΄μ λνλλ κ²½κ³ λΌκ³ νλ€) λ¨ 2κ° λΏμμ μμκ³ , κ²°κ΅ μμ€μ 맨 μμ€μ
#pragma warning(disable: 4786 4788)νμ€μ μΆκ°ν¨μΌλ‘ ν΄κ²°μ λ΄€λ€.
NeoCoin μ Debug λͺ¨λμμ, κ°μ μΆμ ν κ²μ ν¬κΈ°νκ³ , Project Setting -> C/C++ tab -> Debug info -> Line Numbers Only λ‘ λκ³ μ΄λ€.
νμ§λ§, μ΄λ¬ν κ²½κ³ λ Visual C++ 6.0 μμλ§ μ ν¨νκ²μ΄κ³ , VS.NET λΆν° μΆκ° μΈν
μ΄ νμ μλ€. VC++ 6.0 μμλ mapμ λ¬Όλ‘ STLPort λ, Boost μ¬μ©νλ κ²μ κΆμ₯νμ§ μλλ€. λ μ΄μ MS μΈ‘μ μ»΄νμΌλ¬ κΈ°μ μ§μμ΄ μμΌλ―λ‘, VS.NET μ΄μ λ²μ μ μ¬μ©ν΄μΌ νλ€.
λΏλ§ μλλΌ libμ μΆκ°λ±μ΄λΌλμ§ μ΄ νμΌμ΄ λ¨ νλ²λ§ μ΄λ¦¬κ² ν μλ μλ€.
#pragma comment(lib, "d3dx9") // dx9.lib νμΌμ λ§ν¬μ ν¬ν¨νλ€. #pragma once // μ΄ νμΌμ νλ²λ§ μ΄λ¦¬κ² νλ€.
νΉμλΌλ.. μ #pragma warning(disable: n ... m) μ μ¨μ μΈμ λ λ¬Έμ λ₯Ό ν΄κ²° ν μ μμκ±°λΌκ³ μκ°νμλ©΄ μλ©λλ€. μ μμ μ€λͺ
μλ μμ¬μλ―μ΄, pragma directive λ μ§κ·Ήν.. μμ€ν
μ μμ‘΄μ μ
λλ€. κ·Έλ¬λ―λ‘, VC μμλ λ¨Ήνλ€λ μ λͺ
λ Ήμ΄κ° GCC μμλ μλ μλ μκ³ .. λ κ·Έλ°κ²λλ€. νμ€νκ² μ°κ³ μΆμΌμλ€λ©΄.. κ·Έ μ»΄νμΌλ¬μ λ¬Έμλ₯Ό μ°Έμ‘°νλκ²μ΄ λμλ κ²λλ€.
νμ€μΌλ‘ μ ν΄μ§ λͺλͺμ pragma directive κ° μλ€κ³ μκ³ μλλ°.. κ·Έκ²λ€μ λ΄ν€λ©΄ μ 리ν΄μ μ¬λ €λ³΄κ² μ΅λλ€.