c语言字符变量grade如何定义,c语言变量命名规则_较多较乱(C language variable naming _ more chaos).doc...

c语言变量命名规则_较多较乱(C language variable naming _ more chaos)

c语言变量命名规则_较多较乱(C language variable naming _ more chaos)

A few years ago, Charles Simonyi (who later became a famous programmer of Microsoft) is designed by using a prefix based naming method, this method was called the "Hungarian notation" to commemorate him. His thought is according to each identifier means to give it a prefix. Microsoft later adopted this idea for each identifier a prefix to illustrate its data type. Therefore, the prefix n is integer, long integer variable is NL, character type array variable is Ca, and the string (end with empty character array type) with SZ as the prefix. These names may be very strange. For example: lpszFoo "Foo" is a pointer to a null terminated string for the long pointer.

The advantage of this method is to enable people to pass the name of the variable to identify the type of a variable, rather than to find the definition of it. Unfortunately, this method not only makes the variable name very chatty, but to change the variable type work has become very difficult. In Windows3.1, the whole type variable to 16 wide if. We use an integer variable at the beginning, but after the calculation by 30---40 function, using the integer variable width is not enough, then we should not only change the type of the variable, but also to change the name of this variable in the 30--40 function.

Because of unrealistic, except for some stubborn Yuanwai Windows program has no one to use the "Hungarian notation". There is no doubt that in some occasions, it still exists, but most people have now abandoned it. In general, the input prefix is a bad idea, because it put the variable in its type tightly tied together.

Hungarian methods generally have advantages over functions that are less than 30 lines.

Especially for interface programming, it has advantages.

But the Hungarian approach is a disaster for algorithms that have strong computational requirements, especially with many abstract types of C++.

Look where you're using it.

Now there are good

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值