现在的位置: 首页 > 综合 > 正文

不同编译器 函数用法or 函数命名冲突用法(待完善)

2018年01月18日 ⁄ 综合 ⁄ 共 347字 ⁄ 字号 评论关闭

此处笔记

宏使用避免命名冲突

例1:
#if  defined (_HP_) || defined (__WIN__) ||defined(__LINUX__)
typedef char				int8;
typedef short				int16;
typedef int					int32;
#endif

例2:
#define __Linux 0xffff

#ifdef __hpux 	
	iconv_t cd = iconv_open("utf8", "hp15CN");
#elif defined _AIX 	
	iconv_t cd=iconv_open("UTF-8","GB18030");
#elif defined __Linux	
  iconv_t cd=iconv_open("UTF-8","GB2312");
#endif 	

	if (cd == (iconv_t)-1) xxxxx;

 

 

 

抱歉!评论已关闭.