Use good naming practice when declaring variable names.
Studies show that programs with names averaging 10 to 16 characters are the easiest to debug. The name length is just a guideline; the most important thing is that the name conveys a clear meaning of what it represents.
Do not overload commonly used terms.
For example, EFI has an event model, so don't call some abstraction that you define an Event. People will get confused. Make sure someone reading the code can tell what you are talking about.
Each word or concept must start with a capital letter and be followed by lower-case letters.
The intent is for names to be consistent and easily readable. Each word in a compound name should be visually distinct.
Identifiers beginning with an underscore are always reserved
Define them only in the special ways allowed elsewhere in this document.
Identifiers that are defined in the Standard C and POSIX libraries are always reserved.
This includes macros, typedefs, variables, and functions, whether with external linkage or file scope. The only exception is with modules that are mutually exclusive with these libraries. These reserved identifiers are listed in "Reserved Identifiers" and reserved keywords are listed in "Reserved Keywords".
Use the correct opposites when declaring names.
Table 1 Common Opposites
add / remove
begin / end
create / destroy
increment / decrement
first / last
get / release
lock / unlock
put / get
up / down
old / new
min / max
next / previous
source / destination
open / close
show / hide
source / target
start / stop
This document describes a common set of abbreviations that can be freely used. If you must make up abbreviations, remember the name is most important to the reader of the code, not the writer.
Any abbreviation used, which is not documented in this specification, or in the UEFI Specification shall be placed into a Glossary section of the File header as specified in See "File Heading".
Do not define a new abbreviation to replace an abbreviation that is already defined in this document. For example, do not define No to mean Number, because Num is the supported abbreviation.
"EFI Supported Abbreviations" below lists the abbreviations that are standardized by this document and do not require a defining comment.
Table 2 EFI Supported Abbreviations
EFI Boot Services Table
EFI Runtime Table
EFI System Table
EFI Task Priority Level
You are encouraged to use the IEC international abbreviations for powers of 2 (KiB for 2^10, MiB for 2^20, GiB for 2^30, etc.) rather than the old KB, MB, and GB, which IEC now reserves for powers of 10 (10^3, 10^6, 10^9). Given that many readers of the code may not have made the conversion to add the 'i', do not use KB, MB, and GB for powers of 10 Instead, use e.g. "2*10^6 bytes" instead of 2MB to avoid confusion. Note that GiB is derived from the G in 'Giga', the 'i' in binary, and the B in 'Byte'.
Please remember the golden rule: Code for the person who will have to read and maintain your code. Making up your own vocabulary to describe your module can lead to lots of confusion.
If you must create acronyms, they must be fully defined in the documentation
18.104.22.168.1 Translation tables are required for each module using a created acronym
Each module that uses the acronym must contain a translation table comment in the file header. This definition is required so that others can understand your names and comments.
It's okay to use acronyms for industry standards.
Acronyms such as Pci, Acpi, Smbios, Isa, (capitalized per the variable naming convention) are all legal to use without defining their meaning.
If you reference an industry standard acronym, the file header must define to which version of the specification the code is written. Thus, a PCI resource manager would state that it was coded to follow the PCI 2.2 Specification and which optional features it included support for.
For example, use "PCI" in comments and documentation, and "Pci" for functions, files, etc.
The table below lists the acronyms that are considered integral to the EDK II vernacular, and may be used without defining their meaning in a comment.
Table 3 EFI Supported Acronyms
In an Identifier
Advanced Configuration and Power Interface
Accelerated Graphics Port
American National Standards Institute
American Standard Code for Information Interchange
Advanced Technology Attachment
Advanced Technology Attachment Packet Interface
Boot Flash Device
Basic Input/Output System
Boot Integrity Services
Complementary metal oxide semiconductor
Central processing unit
Cyclic Redundancy Check
Direct Memory Access
Driver Execution Environment
Extensible Firmware Interface
First In First Out
Globally Unique Identifier
International Electrotechnical Commission
Industry Standard Architecture
International Standards Organization
Nonvolatile Random Access Memory
Peripheral Component Interconnect
Pre-EFI Initialization environment
Random Access Memory
Static Random Access Memory
Task Priority Level
Unified Extensible Firmware Interface
Universal Network Driver Interface
Universal Serial Bus
Video graphics array