Comparison of naming methods between Hungary and Camel and Pascal

Source: Internet
Author: User
Tags uppercase letter

Hungarian nomenclature : widely used in environments such as Microsoft Windows.

The naming convention for variables (and also macros) used in Windows programming is the Hungarian nomenclature, which is presented by a competent Microsoft programmer Charles Simonyi Charles Simonyi.

The Hungarian nomenclature identifies the scope, type, and so on, by prefixing the variable name with the corresponding lowercase letter symbol identifier. These symbols can be used at the same time, the order is first m_ (member variable), then the pointer, then the simple data type, and so on. For example: M_lpszstr, which represents a long pointer member variable that points to a string that ends with a 0 character.

The key to the Hungarian nomenclature is that the name of the identifier is prefixed with one or more lowercase letters, followed by a word or combinations of words that are capitalized in the first letter, which indicates the purpose of the variable.

prefix of lowercase letters commonly used in Hungarian nomenclature:

prefix type
a arrays (array)
B Boolean Value (Boolean)
by Byte (byte)
c signed character (Char)
CB unsigned character (Char Byte, not many people used)
CR Color reference value (COLORREF)
cx,cy Coordinate difference (length shortint)
DW Double Word
fn function
h Handle (handle)
I integral type
L Long int
LP Long Pointer
members of the M_ class
n short integer (shorter int)
NP near Pointer
P Pointer
S-String
SZ null-terminated string type (string with Zero end)
W Word


Second, the Camel name Law :

camel-like command, as its name implies, is a mixture of uppercase and lowercase letters to form the names of variables and functions. For example, the following is the same function that is named with the camel-named method and the underscore method, respectively:

printemployeepaychecks ();

print_employee_paychecks ();

The first function name uses camel-named notation-each logical breakpoint in the function name is marked with an uppercase letter, and the second function name uses the underscore method----each logical breakpoint in the function name is marked with an underscore.

Camel-style nomenclature has become more popular in recent years, with many new libraries and Microsoft
in an environment like windows, it is used in many proper phases. On the other hand, the underscore is popular after the advent of C, in many of the old Programs and UNIX environment, it is very common use.


Pascal (Pascal) nomenclature :

similar to the Camel name law. But the camel nomenclature is the first letter lowercase, and the Pascal nomenclature is capitalized

such as: public void
displayinfo ();

string UserName;

both use Pascal's nomenclature.


In C #, the name of Pascal and the name of the camel are mostly.

Comparison of naming methods between Hungary and Camel and Pascal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.