说说大家编程时最容易犯的错误
文章内容
偶做C++的,最麻烦的就是指针。。。但又是最强大的,很多人对指针敬而远之,但是对有assembly编程经验的人来说,一切又那么自然
分享: | 分享到微信 |
文章评论
3M | 评论 由于写多了php程序,很容易在javascript的变量前面加上$
2008-11-10 09:47:51 | 引用 |
Re: 说说大家编程时最容易犯的错误
最喜欢把 if(i == 0)写成if (i = 0) 2008-11-10 09:57:17 | 引用 |
SARS |
7thGuest | Re: 说说大家编程时最容易犯的错误
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: 说说大家编程时最容易犯的错误
我从来都这样写: if(0 == i) 可以防止出错。 2008-11-10 10:01:56 | 引用 |
deerlake |
7thGuest | Re: 说说大家编程时最容易犯的错误 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: 说说大家编程时最容易犯的错误
then you can complain that the reader don't have good coding behavior. 2008-11-10 12:20:50 | 引用 |
无题 Pass by ref in C#. (I don't make this kind of mistake anymore )
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 |