Loading... ## 判断平台32还是64 ```cpp #ifdef _WIN32 //windows x86 or x68 #ifdef _WIN64 //x64 typedef uint64_t point_t; #else //x86 typedef uint32_t UPoint; #endif //_WIN64 #else //unix #ifdef __x86_64__ //x64 #elif __i386__ //x86 #endif #endif //_WIN32 ``` ## 标准预定义宏 ```cpp __LINE__ // 在源代码中插入当前源代码行号; __FILE__ // 在源文件中插入当前源文件名; __FUNCTION__ // 在源文件中插入当前函数名; __DATE__ // 在源文件中插入当前的编译日期 __TIME__ // 在源文件中插入当前编译时间; __STDC__ // 当要求程序严格遵循ANSI C标准时该标识被赋值为1; __cplusplus // 当编写C++程序时该标识符被定义。 //例子 printf("行号:%d 函数名:%s \n", __LINE__, __FUNCTION__); ``` ## 常用的声明 ```cpp //#pragma comment(linker,"/subsystem:\"windows\" /entry:\"mainCRTStartup\"") // 隐藏控制台窗口显示 #pragma comment(linker,"/INCREMENTAL:NO") // 减小编译体积 #pragma comment(linker, "/section:.data,RWE") // 启用数据段可读写 ``` 最后修改:2022 年 04 月 22 日 © 允许规范转载 赞 0 如果觉得我的文章对你有用,请随意赞赏