Chinaunix首页 | 论坛 | 博客
  • 博客访问: 968694
  • 博文数量: 200
  • 博客积分: 5011
  • 博客等级: 大校
  • 技术积分: 2479
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-27 15:07
文章分类

全部博文(200)

文章存档

2009年(12)

2008年(190)

我的朋友

分类:

2008-11-14 10:35:45

    wchar_t是ISO C/ANSI C的标准中的类型,他并没有定义其宽度,而留给具体的实现。在

windows下,为16bit,在unix like下为32bits。因此他并不具有portable特性,在不同环境下不一样,因此如果你想让你的程序具有可移植性,建议不要用wchar_t来存储你要存储的数据。

    Wide character is a computer programming term. It is a vague term used to represent a that is richer than the traditional (8-bit) characters. It is not the same thing as .

wchar_t is a data type in ANSI/ISO and some other that is intended to represent wide characters.

The standard 4.0 says that

"ANSI/ISO C leaves the semantics of the wide character set to the specific implementation but requires that the characters from the portable C execution set correspond to their wide character equivalents by zero extension."

and that

"The width of wchar_t is compiler-specific and can be as small as 8 bits. Consequently, programs that need to be portable across any C or C++ compiler should not use wchar_t for storing Unicode text. The wchar_t type is intended for storing compiler-defined wide characters, which may be Unicode characters in some compilers."

Under , wchar_t is 16 bits wide and represents a code unit. On -like systems wchar_t is commonly 32 bits wide and represents a code unit.

In , and deal with the wide characters.

阅读(1747) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~