说说大家编程时最容易犯的错误

文章内容

偶做C++的,最麻烦的就是指针。。。但又是最强大的,很多人对指针敬而远之,但是对有assembly编程经验的人来说,一切又那么自然
QR Code
请用微信 扫一扫 扫描上面的二维码,然后点击页面右上角的 ... 图标,然后点击 发送给朋友分享到朋友圈,谢谢!
分享:
分享到微信

文章评论

SARS
Re: 说说大家编程时最容易犯的错误
deerlake 写道:

我从来都这样写:

if(0 == i)

可以防止出错。


呵呵,i == 0只是个例子,多数时候出错是等号两边都是变量。

2008-11-10 12:40:59 | 引用
无题
C语言数组和指针边界最容易出错,导致内存泄漏最麻烦。

2008-11-11 00:28:17 | 引用
rainfly
白茫茫
无题
最容易犯的错误是自认为很简单,而不去测试所有的case。

2008-11-11 15:16:36 | 引用
无题
白茫茫 写道:
最容易犯的错误是自认为很简单,而不去测试所有的case。

我就不从不test...
客户找到我再说。。。

2008-11-21 22:21:30 | 引用
nessus
voice
无题
bigbigloser 写道:
Pass by ref in C#. (I don't make this kind of mistake anymore icon_smile.gif )

1. MyMethod1(MyClass obj)
{
MyClass localObj ......

obj = localObj;
}
2. MyMethod2(ref MyClass obj)
{
MyClass localObj ......

obj = localObj;
}

If obj is not null, MyMethod1 and MyMethod2 will give you the same result.

If obj is null, after call MyMethod1, obj is still null. but MyMethod2 will give you obj you want.


为什么obj非空的时候莫有区别?

2008-11-22 09:17:59 | 引用
上一页12下一页

发表评论

个人简介

webdriver
『人生游戏,游戏人生』


日志分类
最新日志
此功能已被空间主人关闭
博客搜索
 
快速导航
友情链接
此功能已被空间主人关闭
博客统计
点击: 701235
帖子数量: 691
开辟个人空间: 2008-10-15
最后更新: 2018-05-11
左邻右舍
还没有任何会员到访.
 
 
 
 
 
The images, logos, trademarks used on this site and all forwarded content are the property of their respective owners.
We are not responsible for comments posted by our visitors, as they are the property of the poster.
All other content of this website is copyrighted by 加西网

Private Policy | moonlake oblog skin

加西网为北美中文网传媒集团旗下网站