hungariant notation

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.

PrefixTypeExample
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-prefixTypeExample
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;
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值