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

文章内容

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

文章评论

3M
评论
由于写多了php程序,很容易在javascript的变量前面加上$

2008-11-10 09:47:51 | 引用
Re: 说说大家编程时最容易犯的错误
webdriver 写道:
偶做C++的,最麻烦的就是指针。。。但又是最强大的,很多人对指针敬而远之,但是对有assembly编程经验的人来说,一切又那么自然


最喜欢把 if(i == 0)写成if (i = 0) big_think.gif

2008-11-10 09:57:17 | 引用
SARS
7thGuest
Re: 说说大家编程时最容易犯的错误
SARS 写道:
webdriver 写道:
偶做C++的,最麻烦的就是指针。。。但又是最强大的,很多人对指针敬而远之,但是对有assembly编程经验的人来说,一切又那么自然


最喜欢把 if(i == 0)写成if (i = 0) big_think.gif

most today's compiler will issue warning of this.

2008-11-10 09:59:07 | 引用
无题
C++做多了,基本上不出什么错。

但做php, perl 的编译不强的程序时,经常犯的错是忘了变量前加$,这个还好,程序会出错。最怕变量名引用时写错了,如大小写,有无下划线等,程序不会出错,就不正确结果,调试时常常给弄疯了。

2008-11-10 10:01:00 | 引用
deerlake
webdriver
无题
又一阵狂用STL,vector,list等等container,结果发现也不是那么容易用的,每个class想放进去,还得自己实现copy constructor

2008-11-10 10:01:07 | 引用
Re: 说说大家编程时最容易犯的错误
SARS 写道:
webdriver 写道:
偶做C++的,最麻烦的就是指针。。。但又是最强大的,很多人对指针敬而远之,但是对有assembly编程经验的人来说,一切又那么自然


最喜欢把 if(i == 0)写成if (i = 0) big_think.gif


我从来都这样写:

if(0 == i)

可以防止出错。

2008-11-10 10:01:56 | 引用
deerlake
7thGuest
Re: 说说大家编程时最容易犯的错误
deerlake 写道:

我从来都这样写:

if(0 == i)

可以防止出错。


this is a good trick icon_smile.gif

2008-11-10 10:04:18 | 引用
Re: 说说大家编程时最容易犯的错误
if(0 == i)

It's good until somebody complain the readability.

2008-11-10 12:18:28 | 引用
许万克
bigbigloser
Re: 说说大家编程时最容易犯的错误
XMLENCODER 写道:
if(0 == i)

It's good until somebody complain the readability.


then you can complain that the reader don't have good coding behavior. big_happy.gif

2008-11-10 12:20:50 | 引用
无题
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.

2008-11-10 12:28:19 | 引用
bigbigloser
上一页12下一页

发表评论

个人简介

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


日志分类
最新日志
此功能已被空间主人关闭
博客搜索
 
快速导航
友情链接
此功能已被空间主人关闭
博客统计
点击: 650815
帖子数量: 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

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