设为首页  
联系我们  
加入收藏  
网页制作 冲浪宝典 图形图像 操作系统 软件教学 编程开发 认证考试 安全技术 站长专区 文学驿站 娱乐天地 游戏天地 办公软件
文章搜索
您的位置: 首页 >> 文章首页 >> 编程开发 >> 其他开发语言 >> C++ Without Memory Errors
精品推荐
其他开发语言点击TOP10
·数字小键盘指法练习
·用C语言编通讯录程序(初学者级别的)
·Modem 常用AT指令集
·单片机模拟I2C总线及24C02(I2C EEPROM)读写实例(源代码)
·C++经典电子书下载
·Thinking in C++ 简体中文第二版
·debug和release的区别
·error LNK2001: unresolved external symbol __ftol2 错误解决
·C库函数手册
·一个简单的C语言编译器
编程开发点击TOP10
·数字小键盘指法练习
·ASP.NET 程序中常用的三十三种代码
·用C语言编通讯录程序(初学者级别的)
·我写的Java学生成绩管理系统源代码
·CHK文件恢复工具
·Modem 常用AT指令集
·java笔试题
·异常java.sql.SQLException: Io exception:The Network Adapter could not establish connection
·单片机模拟I2C总线及24C02(I2C EEPROM)读写实例(源代码)
·C++经典电子书下载
精选专题

C++ Without Memory Errors

作者: 来源:网络文章 时间:2005-12-17 21:00:18

C++ Without Memory Errors(1)

VBar>Home -> C++ Without Memory Errors

C++ Without Memory Errors

by Dejan Jelović

Here are the slides and the code from a recent talk I've given on writing C++ programs without memory errors.

An article with more details will be ready soon.


Memory errors are the worst kind of errors in C and C++. They are hard to reprodUCe and thus hard to debug. Have you ever used a non-trivial C or C++ program that never crashed?


I've been programming in Java for the last year. In Java one sees almost no hard to reproduce problems. Why is that?


Is it because Java is a safer language? No. Java makes you use too many casts and lacks support for types with value semantiCS. It doesn't have destructors so resource management is really hard. It is less safe than C++.


The real reason is garbage collection.


How does garbage collection help? Does it free us from freeing memory? Not really. Try implementing a Vector in Java and you will see how easy it is to forget to set a reference to null, thus leaking memory.


The benefit of garbage collection is this: it guarantees that a pointer will either point to a valid allocated object or be null.


Think about it: if a pointer is either valid or null, there can be no weird memory errors.


How do we do that in C++?


How about adding garbage collection to C++? A company named Geodesic claims their garbage collector for C++ works great.


共4页 9 7 [1] [2] [3] [48 :>

C++ Without Memory Errors 相关文章:
C++ Without Memory Errors 相关软件:
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
转载请注明来源:http://www.xgdown.com