initialize the variables!!!
来源:互联网 发布:php前端和后端的区别 编辑:程序博客网 时间:2024/05/21 09:29
Using an uninitialized object is a common program error, and one that is often difficult to uncover. The compiler is not required to detect a use of an uninitialized variable, although many will warn about at least some uses of uninitialized variables. However, no compiler can detect all uses of uninitialized variables.
Sometimes, we're lucky and using an uninitialized variable results in an immediate crash at run time. Once we track down the location of the crash, it is usually pretty easy to see that the variable was not properly initialized.
Other times, the program completes but produces erroneous results. Even worse, the results can appear correct when we run our program on one machine but fail on another. Adding code to the program in an unrelated location can cause what we thought was a correct program to suddenly start to produce incorrect results.
The problem is that uninitialized variables actually do have a value. The compiler puts the variable somewhere in memory and treats whatever bit pattern was in that memory as the variable's initial state. When interpreted as an integral value, any bit pattern is a legitimate value—although the value is unlikely to be one that the programmer intended. Because the value is legal, using it is unlikely to lead to a crash. What it is likely to do is lead to incorrect execution and/or incorrect calculation.
- initialize the variables!!!
- 019. Always initialize variables.
- THE HANDLER_READ_* STATUS VARIABLES
- the variables of python
- the class variables initlization
- Variables
- Variables
- Variables
- variables
- Variables
- about the storageof variables (arm7 platform)
- Learning Perl: 8.6. The Match Variables
- Bind variables - The key to application performance
- JavaScript quirk 6: the scope of variables
- cmd operation about the environmental variables
- [Python]Functions, Variables, and the Call Stack
- WARN Please initialize the log4j system properly.
- vc6 解决 "Cannot initialize the debugging subsystem"
- 又是星期六了
- pdf2swf font2swf avi2swf
- 设计模式c#语言描述——装饰(Decorator)模式
- Matrix Template Library Help
- 关于ORM实体映射的感想 (Object /Relational Mapper) GOOD!
- initialize the variables!!!
- ASP.NET中TreeView控件使用小结
- definition vs declaration of variables
- [转载].Net网络资源
- 微软的O/R映射技术--Visual Studio "Whidbey"的对象空间初识
- nhibernate源码分析之一: 对象映射
- 在ASP.NET中实现多文件上传
- .Grove—— .Net下的ORM框架
- -在javascript中获取机器名和window登录名