# 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.

• 本文已收录于以下专栏：

举报原因： 您举报文章：A bug in MSDN 2005 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)