跨平台判断64位和32位开发的一些宏定义

#ifdef _WIN32
//windows x86 or x68
#ifdef _WIN64 //x64 windows
	typedef uint64_t point_t;
#else //x86 windows
	typedef uint32_t UPoint;
#endif //end of _WIN64
#else //unix
#ifdef __x86_64__ //x64 unix
#elif __i386__ //x86 unix
#endif //end of __x86_64__
#endif //end of _WIN32

_WIN32是在Windows32位和64位都会有define的,所以区分64还是32位主要用到的是_WIN64,_WIN32只用作区分是否Windows系统

ANSI C标准中的预定义宏:

__LINE__ // 在源代码中插入当前源代码行号;
__FILE__ // 在源文件中插入当前源文件名;
__FUNCTION__ // 在源文件中插入当前函数名;
__DATE__ // 在源文件中插入当前的编译日期
__TIME__ // 在源文件中插入当前编译时间;
__STDC__ // 当要求程序严格遵循ANSI C标准时该标识被赋值为1;
__cplusplus // 当编写C++程序时该标识符被定义。

//例子
printf("行号:%d 函数名:%s \n", __LINE__, __FUNCTION__);
posted @ 2019-05-09 16:35  albertPaul  阅读(4612)  评论(0编辑  收藏  举报