Windows Naming conventions

Source: Internet
Author: User

Name of function:

• Refer to the naming conventions for Windows APIs.

• It is recommended to use the movable-object structure. Function names should clearly reflect the function and purpose of the functions.

• The function name must be no longer than 30 characters.

• The first letter of the function name must be capitalized.

• The global function must begin with a lowercase prefix "g".

4. Variable name:

In principle, the names of variables are named in accordance with the Hungarian notation. That is: prefix + type + variable name

1) Format:

[M_|s_|g_] Type [class name|struct name] variable name

2) Explanation:

m_: Member variables of a class

ms_: Static member Variable of class

s_: Static global variables

g_: Normal global variables

• Type abbreviations (types)

Char, Tchar:ch

char[],tchar[]: SZ

bool, BOOL:B

int, __int16,__int32,__int64:n

long:l

double:d

float:ft

· Byte:by

· Word:w

· Dword:dw

Unsigned:u

FUNCTION:FN

P:pointer

Lp:pointer

The name of the variable must be no longer than 20 characters.

5. Class Name:

• You must start with a capital "K" and the following letters reflect the specific meaning, in order to clearly express the purpose and function of the class principle.

• The interface must start with a capital "I" and represent Interface.

• When a name is made up of multiple words, the first letter of each word must be capitalized.

6, structure name, macro name, enumeration name, Union name:

• All uppercase.

• Enumeration name plus lowercase prefix "enum".

Cases:

typedef enum _KFILE_OPEN_MODE

{

enumopen_readonly = 0,

Enumopen_readwrite = 1,

Enumcreate_alway = 3

} Kfile_open_mode;

• Macro name plus lowercase prefix "def".

Cases:

#define DEFMAXNUMBER 100

• The structure name is prefixed with the lowercase prefix "tag" and must be preceded by a capital "K".

Cases:

typedef struct TAGKPOINT

{

int x;

int y;

} Kpoint;

• Union name plus lowercase prefix "uni".

Cases:

typedef Union _variant{

Char Unichval;

int uninval;

Long Unilval;

float Uniftval;

...

} VARIANT;

Windows Naming conventions

Related Article

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.