VC++2005中的unsigned short和wchar_t

news/2024/7/4 9:25:06
      很多人可能会认为unsigned short和wchar_t是一个东西。其实不然。在C++标准中,wchar_t是个内建的类型,长度是16bit。所以很多编译器就直接typedef unsigned short wchar_t。 但是事实上他们并不完全是一个东西。所以该写wchar_t还是写wchar_t。不要跟unsigned short混合起来写。
      举个例子。在VC++2005中有个编译开关叫: trait wchar_t as build-in type。如果打开这个选项那么wchar_t和unsigned short就完全是两个类型,也就是说 void function(wchar_t arg) 和void function(unsigned short)是两个参数不同的函数,反之则是一个函数。 这个在同一个工程中问题不大。但是如果你在两个不同的工程里
 trait wchar_t as build-in type这个选项设置不同的话,就会出现问题。具体原因大家自己去想。呵呵。懒得写了。
     总之,遵守标准来写代码。总是对的。



http://www.niftyadmin.cn/n/3647813.html

相关文章

把html设置为桌面项目_如何设置HTML项目

把html设置为桌面项目How To Build a Website With HTML 如何使用HTML构建网站This tutorial series will guide you through creating and further customizing this website using HTML, the standard markup language used to display documents in a web browser. No prior…

redis 数据库管理工具_如何管理Redis数据库电子书

redis 数据库管理工具Download the Complete eBook!下载完整的电子书! How To Manage a Redis Database eBook in EPUB format 如何以 EPUB格式 管理Redis数据库电子书 How To Manage a Redis Database eBook in PDF format 如何管理 PDF格式 的Redis数据库电子书 …

html中p元素添加超链接_如何在HTML中添加超链接

html中p元素添加超链接How To Build a Website With HTML 如何使用HTML构建网站This tutorial series will guide you through creating and further customizing this website using HTML, the standard markup language used to display documents in a web browser. No prio…

多线程的资源管理器

正在设计中.比较郁闷.设计要求: 1. 基于template. 多线程的功能为类的一个策略。 2. 管理器应该有能力知道当前的资源处于什么状态RS_LOADING RS_FAILED RS_NOTLOAD, RS_LOADED. 3. 加载线程应该为一个工作线程池。并非每一个资源管理器都使用一个thread. 4. 每个资源能支持…

angular 参数映射_如何在Angular中使用查询参数

angular 参数映射介绍 (Introduction) Query parameters in Angular allow for passing optional parameters across any route in the application. Query parameters are different from regular route parameters, which are only available on one route and are not optio…

html 属性中使用变量_如何使用HTML属性

html 属性中使用变量How To Build a Website With HTML 如何使用HTML构建网站This tutorial series will guide you through creating and further customizing this website using HTML, the standard markup language used to display documents in a web browser. No prior …

CamGameSDK 摄像头游戏SDK提供测试版本。欢迎使用

目前CamGameSDK已经能完成类似CamGoo这个游戏中用到的摄像头图象识别技术。(不知道什么是摄像头游戏的,请下载CamGoo这个游戏)。现在整理出SDK一个。提供大家注册使用。如果有需要请与我联系。申请者填写如下表格一张发到我邮箱:xheartblue16…

如何嵌套HTML元素

How To Build a Website With HTML 如何使用HTML构建网站This tutorial series will guide you through creating and further customizing this website using HTML, the standard markup language used to display documents in a web browser. No prior coding experience i…