Microsoft KB Archive/308380

= PRB: Parameter Definitions Related to Character Sizes Are Named Incorrectly =

PSS ID Number: 308380

Article Last Modified on 11/3/2003

-

The information in this article applies to:


 * Microsoft eMbedded Visual C++, Version:4.0
 * Microsoft Windows CE Platform Builder 3.0

-



This article was previously published under Q308380



SYMPTOMS
Some application programming interface (API) parameter definitions incorrectly use the Hungarian &quot;cb&quot; (count of bytes) to refer to &quot;cch&quot; (count of characters). For those familiar with the Hungarian naming conventions, this parameter naming error can cause confusion.

For example, the definition for the Windows CE API RegEnumKeyEx function includes the following definitions:

LPDWORD lpcbName

LPDWORD lpcbClass

By strict adherence to Hungarian naming conventions, the definitions should, instead, be as follows:

LPDWORD lpcchName

LPDWORD lpcchClass



MORE INFORMATION
In Hungarian notation, the &quot;cb&quot; prefix designates count of bytes, and the &quot;cch&quot; prefix designates count of characters. The definitions lpcbName and lpcbClass refer to the number of characters in the lpName and lpClass string buffers, respectively. A Unicode character is two bytes, whereas an ANSI character is one byte. Therefore, when you name the definitions appropriately with a &quot;cch&quot; prefix, this correctly identifies the meaning of the variable contents.

This example is but one of many cases of this issue in the Windows CE SDK.

NOTE: When the name of a parameter is inconsistent with the parameter description, the parameter description should be used.

Keywords: kbdocerr kbnofix kbprb KB308380

Technology: kbAudDeveloper kbSDKSearch kbVCeMb kbVCsearch kbWinCESDK300 kbWinCESDKSearch kbWinCESearch

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.