C++?е?????????
???????????? ???????[ 2014/12/29 11:41:30 ] ????????C++ ????? ????
???????#pragma warning???
??????????????????????????????????????????
?????????????:
????#pragma warning( warning-specifier : warning-number-list [; warning-specifier : warning-number-list...]
????#pragma warning( push[ ??n ] )
????#pragma warning( pop )
??????????????????????????:
????once:???????(????/?????)???
????default:????????????????????????
????1??2??3??4:??????漶??
????disable:??????????????
????error:??????????????????????
??????????????????????????????ο?????????????????
????#pragma warning( disable : 4507 34; once : 4385; error : 164 )
??????????
????#pragma warning(disable:4507 34) // ?????4507??34????????
????#pragma warning(once:4385) // 4385?????????????????
????#pragma warning(error:164) // ??164??????????????????
?????????pragma warning ????????????
????#pragma warning( push [ ??n ] )
????#pragma warning( pop )
????????n?????????????(1---4)??
????#pragma warning( push )???????о???????????е????????
????#pragma warning( push?? n)???????о???????????е???????????????????
????????趨?n??
????#pragma warning( pop )????е???????????????????????????????????
??????и??????????磺
????#pragma warning( push )
????#pragma warning( disable : 4705 )
????#pragma warning( disable : 4706 )
????#pragma warning( disable : 4707 )
????#pragma warning( pop )
????????δ????????±??????е???????(????4705??4706??4707)
???????????C++???б????????????????????????????Щ??????????????????????
??????????????????#pragma warning(disable:4786)???????????????
??????vc?????ADO?????????????????????????????????????????
????#pragma warning(disable:4146)???????????????????
????????#pragma pack()
??????????????????????????????????????????????(????????????????)?????????????????????????????????????????μ?(4)??
(1)
#pragma pack(1) //???????????1??????
struct A
{
char x; //aligned on byte boundary 0
int y; //aligned on byte boundary 1
}a;
sizeof(a)==5
(2)
#pragma pack(2) //???????????2??????
struct A
{
char x; //aligned on byte boundary 0
int y; //aligned on byte boundary 2
}a;
sizeof(a)==6
(3)
#pragma pack(4) //???????????4??????
struct A
{
char x; //aligned on byte boundary 0
int y; //aligned on byte boundary 4
}a;
sizeof(a)==8
(4)
#pragma pack() //????????#pragma pack(8) ???????????8??????
struct A
{
char x; //aligned on byte boundary 0
int y; //aligned on byte boundary 4
}a;
sizeof(a)==8
????????????y???С??4?????????????8?????????????1??int???????
??????.#pragma comment
????The following pragma causes the linker to search for the EMAPI.LIB library while linking. The linker searches first in the current working directory and then in the path specified in the LIB environment variable:
????#pragma comment( lib?? "emapi" )
??????.#pragma deprecated
When the compiler encounters a deprecated symbol?? it issues C4995:
void func1(void) {}
void func2(void) {}
int main() {
func1();
func2();
#pragma deprecated(func1?? func2)
func1(); // C4995
func2(); // C4995
}
??????.#pragma message
????The following code fragment uses the message pragma to display a message during compilation:
????#if _M_IX86 == 500
????#pragma message( "Pentium processor build" )
????#endif
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11