Hungarian Notation

简介:

Charles Simonyi is credited with first discussing Hungarian Notation. It is a variable naming convention that includes C++ information about the variable in its name (such as data type, whether it is a reference variable or a constant variable, etc). Every company and programmer seems to have their own flavor of Hungarian Notation. The following is just what we thought seemed easy for beginning students to understand.

Prefix Type Example
b boolean bool bStillGoing;
c character char cLetterGrade;
str C++ String string strFirstName;
si short integer short siChairs;
i integer int iCars;
li long integer long liStars;
f floating point float fPercent;
d double-precision floating point double dMiles;
ld long double-precision floating point long double ldLightYears;
sz Old-Style Null Terminated String char szName[NAME_LEN];
if Input File Stream ifstream ifNameFile;
is Input Stream void fct(istream &risIn);
of Output File Stream ofstream ofNameFile;
os Output Stream void fct(ostream &rosIn);
S declaring a struct struct SPoint
{
C declaring a class class CPerson
{
struct name or abbrev declaring an instance of a struct SPoint pointLeft; 
SPoint ptLeft; // or abbrev. (be consistent)
class name or abbrev declaring an instance of a class CPerson personFound;
CPerson perFound; // or abbrev. (be consistent)

The following table contains letters that go before the above prefixes.

Pre-prefix Type Example
u unsigned unsigned short usiStudents;
k constant formal parameter void fct(const long kliGalaxies)
r reference formal parameter void fct(long &rliGalaxies)
s static static char scChoice;
rg array (stands for range) float rgfTemp[MAX_TEMP];
m_ member variable of a struct or class char m_cLetterGrade;
p pointer to a single thing char *pcGrade;
prg dynamically allocated array char *prgcGrades;

目录
相关文章
|
10月前
12-JavaScript(数字型Number)
12-JavaScript(数字型Number)
|
JSON JavaScript 前端开发
JSON 字符串转换为 JavaScript 对象
JSON 字符串转换为 JavaScript 对象
66 0
|
JavaScript 前端开发
Requesting JavaScript AST from selection
Requesting JavaScript AST from selection
Requesting JavaScript AST from selection
|
XML JSON JavaScript
JSON(JavaScript Object Notation)标准的数据交换格式。
JSON是指JavaScript Object Notation(JavaScript对象标记)简称JSON。(数据交换格式)JSON主要作用是:一种标准的数据交换格式。JSON以JS对象的形式存在!JSON是一种标准的,轻量级的数据交换格式。
【1073】Scientific Notation (20 分)
【1073】Scientific Notation (20 分)【1073】Scientific Notation (20 分)
77 0
|
前端开发 JavaScript
escape in ABAP and JavaScript
escape in ABAP and JavaScript
81 0
escape in ABAP and JavaScript
|
XML 数据格式
ABAP XSLT(Extensible Stylesheet Language Transformation)
ABAP XSLT(Extensible Stylesheet Language Transformation)
120 0
ABAP XSLT(Extensible Stylesheet Language Transformation)
|
XML JSON JavaScript
JavaScript、Json中的单引号、双引号
本篇稍微讲下单引号、双引号与JavaScript和JSON之间错综复杂的关系哈,不注意的话还真可能有点懵圈。 首先在JavaScript中,单引号、双引号意义相同,完事。猫哥也是时而用单引号,时而用双引号,现在倾向于使用双引号。
636 0
1073. Scientific Notation (20) 棒棒的
Scientific notation is the way that scientists easily handle very large numbers or very small numbers.
917 0