C++ Coding Style
2015-04-11 11:12
155 查看
This blog is to demonstrate the coding style that I use.
The formulation is [Scope]_[Prefix][Qualifier].
Eg. m_nAge
m means it's a member variable of a class or a structure.
n means it's integer.
Age demonstrates the usage of this variable.
1) Variable Naming Rule
Usually a variable 's name consists of 3 parts, which are scope, prefix, and qualifier.The formulation is [Scope]_[Prefix][Qualifier].
Eg. m_nAge
m means it's a member variable of a class or a structure.
n means it's integer.
Age demonstrates the usage of this variable.
1.1) Scope
Scope is the range in which a variable can be referenced.l | local variable |
g | global variable |
m | member variable of a class or a structure |
i | input variable |
s | static variable |
1.2) Prefix
Prefix indicates the type of a variable.Index | Type | Prefix |
1 | sbyte | sb |
2 | byte | byte |
3 | short | s |
4 | ushort | us |
5 | int | n |
6 | uint | un |
7 | long | l |
8 | ulong | ul |
9 | bool | b |
10 | char | c |
11 | float | f |
12 | double | d |
13 | decimal | dm |
14 | struct | stu |
15 | enum | enum |
16 | object | o |
1.3) Qualifier
Qualifier demonstrates the usage of a variable.相关文章推荐
- c++ coding style
- Google's C++ coding style
- [C/C++] - Tips for Better Coding Style
- Google's C++ coding style
- Google C++ Coding Style:右值引用(Rvalue Reference)
- C++ coding style (for webkit)
- Google C++ Coding Style:引用参数
- Google's C++ coding style
- 从Google C++ Coding Style里面抽出一些贴近现实的rule
- 关于google的C++ coding style
- Elements of Programming Style -- The C++ Style Guide
- Web links for coding style
- 《Exceptional C++ Style》开放样章译稿
- C++ Coding Standards:序言
- C# Coding Style Guide
- The Dearbookian #20041009: C++ Coding Standards 目录公开
- C++ Coding Standards:模板和泛型
- [转]《Exceptional C++ Style》开放样章译稿(第一部分)
- C# Coding Style Guide
- C++ Coding Standards:101条准则、指导方针和最佳实践