A bug in MSDN 2005

Recently when I am programming using Visual C++, I referenced to MSDN 2005. However, when looking up `_mbsinc' and `_mbcdec', I found a bug in MSDN 2005.

In MSDN 2005, the _mbsinc topic contains:

..._mbsinc recognizes multibyte-character sequences according to the multibyte code page currently in use...

Note that MSDN says it uses the current multibyte code page. However in the _mbsdec topic:

The output value is affected by the setting of the LC_CTYPE category setting of the locale; see setlocale for more information. _mbsdec recognizes multibyte-character sequences according to the local currently in use

Note in the above description, firstly, it says the "local" currently in use. It's a typo which should be "locale". Second, the current locale is _different_ from the the current multibyte code page. The current multibyte code page, which can be set in the Control Panel, is usually 936 on Simplified Chinese Windows systems. The current locale, however, is often set to a western one (may be "C") by default.

In MSDN 2005, there is another topic named "Locale". You can find it by typing "setlocale" in Index and look for "Locale" in the index results. Now in that page you can see that _mbsinc and _mbsdec are not listed in the table. It means that they both use the current multibyte code page rather than the current locale.

So it is a bug in MSDN 2005.

I don't know how Borland C++ Compiler 5.5 deals with locales. But as I observe, its mblen function uses the current multibyte code page. It is also possible that the default locale is set to the current multibyte code page, however it is not proven.

New: 20070912 22:01, after my testing, I confirmed that Borland _mbclen and mblen both use the locale, and the locale is set to the system default when the program is up and running.

阅读更多
想对作者说点什么? 我来说一句

vs2005_MSDN

2013年04月24日 146KB 下载

vc++6的msdn 经典

2009年06月02日 11KB 下载

2005年数学建模A题

2009年08月13日 641KB 下载

没有更多推荐了,返回首页

不良信息举报

A bug in MSDN 2005

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭