码迷,mamicode.com
首页 > 其他好文 > 详细

UNICODE和_UNICODE的区别

时间:2015-04-03 06:53:30      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:unicode _unicode


经google,找到如下:

The plain versions without the underscore affect the character set the Windows header files treat as default. So if you define UNICODE, then GetWindowText will map to GetWindowTextW instead of GetWindowTextA, for example. Similarly, the TEXT macro will map to L"..." instead of "...".

The versions with the underscore affect the character set the C runtime header files treat as default. So if you define _UNICODE, then _tcslen will map to wcslen instead of strlen, for example. Similarly, the _TEXT macro will map to L"..." instead of "...".


Looking into Windows SDK you will find things like this:

#ifdef _UNICODE
#ifndef UNICODE
#define UNICODE
#endif
#endif

以上大意就是:没带下划线的UNICODE主要是针对Windows的头文件。

              带下划线的_UNICODE主要是针对C运行库的。

所以自定义时,最好两种都应定义。


UNICODE和_UNICODE的区别

标签:unicode _unicode

原文地址:http://whatever957.blog.51cto.com/6835003/1627843

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!