11<!-- - @file
2- 4.3 Identifiers
2+ 4.4 Identifiers
33
44 Copyright (c) 2006-2017, Intel Corporation. All rights reserved.<BR>
55
2929
3030-->
3131
32- ## 4.3 Identifiers
32+ ## 4.4 Identifiers
3333
34- ### 4.3 .1 Identifiers shall not rely on the significance of more than 31 characters.
34+ ### 4.4 .1 Identifiers shall not rely on the significance of more than 31 characters.
3535
3636Identifiers (variable names, labels, structure tags, derived macro names, etc.)
3737may be an arbitrary length. The ISO standard only guarantees that language
@@ -42,17 +42,17 @@ has been confirmed that 31 character / case significance is supported by EDK II
4242supported tool chains, there is no requirement to ensure uniqueness of
4343externals within the first 6 characters.
4444
45- ### 4.3 .2 Always make identifier names that are visually distinguishable.
45+ ### 4.4 .2 Always make identifier names that are visually distinguishable.
4646
4747While not as big an issue as it has been in the past, when choosing labels
4848ensure that the label is unlikely to be confused with other labels used in the
4949file. Ensure that long label names vary by more than one or two characters.
5050Ensure that labels don't vary between zero and oh (0 and O), one and ell (1 and
5151l). Some also consider 2 and Z, and 5 and S to be similar.
5252
53- ### 4.3 .3 Hungarian Prefixes
53+ ### 4.4 .3 Hungarian Prefixes
5454
55- #### 4.3 .3.1 Use of Hungarian notation is not allowed
55+ #### 4.4 .3.1 Use of Hungarian notation is not allowed
5656
5757This set of detailed guidelines for naming variables and routines is a
5858convention widely used with the C programming language, especially in
@@ -68,7 +68,7 @@ Global data and module data shall be prefixed with 'g' or 'm', respectively.
6868Pointer variables may optionally be prefixed with 'p'. These are the only
6969exceptions to the prohibition against Hungarian notation.
7070
71- #### 4.3 .3.2 Any variable with file scope, or better, shall be prefixed by an 'm' or 'g'
71+ #### 4.4 .3.2 Any variable with file scope, or better, shall be prefixed by an 'm' or 'g'
7272
7373There are no exceptions to this rule. The '` m ` ' prefix identifies a variable
7474with module scope, while a '` g ` ' prefix identifies a global variable.
@@ -78,13 +78,13 @@ gThisIsAGlobalVariableName
7878mThisIsAModuleVariableName
7979```
8080
81- #### 4.3 .3.3 Pointer variables may optionally be prefixed with a 'p'
81+ #### 4.4 .3.3 Pointer variables may optionally be prefixed with a 'p'
8282
8383Time has shown that pass-by-value vs. pass-by-reference errors are
8484significantly reduced with only the introduction of a '` p ` ' prefix for pointer
8585variables.
8686
87- #### 4.3 .3.4 Reasons use of Hungarian prefixes not allowed
87+ #### 4.4 .3.4 Reasons use of Hungarian prefixes not allowed
8888
8989The abstraction of abstract data types is ignored. Instead, base types based on
9090programminglanguage integers or long integers are abstracted. Thus, the names
@@ -100,21 +100,21 @@ Studies have shown that Hungarian notation tends to encourage lazy variable
100100names. It's common to focus on the Hungarian prefix without putting effort into
101101a descriptive name.
102102
103- ### 4.3 .4 Function and Data Names
103+ ### 4.4 .4 Function and Data Names
104104
105- #### 4.3 .4.1 Identifiers shall contain mixed upper- and lower-case text.
105+ #### 4.4 .4.1 Identifiers shall contain mixed upper- and lower-case text.
106106
107107Use of all upper- or all lower-case is very difficult to read because compound
108108words cannot be clearly separated.
109109
110- #### 4.3 .4.2 The names of newly created global entities (such as structures, macros, and defines) shall not use an ` EFI_ ` prefix.
110+ #### 4.4 .4.2 The names of newly created global entities (such as structures, macros, and defines) shall not use an ` EFI_ ` prefix.
111111
112112From now on, the use of ` DXE_ ` and ` PEI_ ` prefixes shall be reserved for DXE and
113113PEI drivers, respectively. If a structure happens to apply equally to PEI and
114114DXE, it should use the prefix ` DXE_ ` . If a structure is local to a particular
115115module only, no special prefix is required.
116116
117- #### 4.3 .4.3 Acronyms are not capitalized in Function and Data Names.
117+ #### 4.4 .4.3 Acronyms are not capitalized in Function and Data Names.
118118
119119When all letters in an acronym are capitalized, it makes the prior and
120120subsequent words visually difficult to distinguish.
@@ -123,14 +123,14 @@ subsequent words visually difficult to distinguish.
123123ThisIsAnExampleOfWhatToDoForPci
124124```
125125
126- #### 4.3 .4.4 Never use C keywords or the names of symbols declared in the standard header files as internal symbols.
126+ #### 4.4 .4.4 Never use C keywords or the names of symbols declared in the standard header files as internal symbols.
127127
128128When you need to use the name of an existing library function for a
129129user-defined function, each use of the user-defined function must be paired
130130with a corresponding comment. The ISO standard does not, however, guarantee
131131that the user-defined function will take priority over the library function.
132132
133- ##### 4.3 .4.4.1 List of the C-reserved keywords.
133+ ##### 4.4 .4.4.1 List of the C-reserved keywords.
134134
135135In principle, the ISO standard, reserves all names beginning with underscore +
136136capital letter, or with underscore + underscore. External symbols names shall
@@ -162,23 +162,23 @@ not begin with an underscore.
162162In addition to those listed, the identifiers asm and fortran are common
163163language extensions and should also be treated as reserved.
164164
165- ### 4.3 .5 Type and Macro Names
165+ ### 4.4 .5 Type and Macro Names
166166
167- #### 4.3 .5.1 Use all capital letters for both #define and typedef declarations.
167+ #### 4.4 .5.1 Use all capital letters for both #define and typedef declarations.
168168
169169This clearly differentiates static declarations from dynamic data types.
170170
171- #### 4.3 .5.2 Each word of a concept shall be separated by an underscore character.
171+ #### 4.4 .5.2 Each word of a concept shall be separated by an underscore character.
172172
173173The underscore effectively separates the words, making names more readable.
174174
175- #### 4.3 .5.3 The use of the "_ t" suffix, designating a type, is not allowed.
175+ #### 4.4 .5.3 The use of the "_ t" suffix, designating a type, is not allowed.
176176
177177```
178178typedef UINT32 THIS_IS_AN_EXAMPLE_OF_WHAT_TO_DO_FOR_PCI;
179179```
180180
181- #### 4.3 .5.4 The names of guard macros shall end with an underscore character.
181+ #### 4.4 .5.4 The names of guard macros shall end with an underscore character.
182182
183183The guard macro, used in the ` #ifndef ` at the start of an include file, uses a
184184postfix underscore character '` _ ` ', in its name in order to prevent collision
@@ -200,7 +200,7 @@ be required if the header files are mutually exclusive.
200200#endif /* FILE_NAME_H_ */
201201```
202202
203- #### 4.3 .5.5 The #else and #endif clauses of conditional compilation blocks shall be commented to identify their context.
203+ #### 4.4 .5.5 The #else and #endif clauses of conditional compilation blocks shall be commented to identify their context.
204204
205205If a conditional compilation construct spans more than seven lines, a comment
206206shall be added to the construct's ` #else ` and ` #endif ` clauses identifying the
0 commit comments