說說大家編程時最容易犯的錯誤

文章內容

偶做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
『人生游戲,游戲人生』


日志分類
最新日志
此功能已被空間主人關閉
博客搜索
 
快速導航
友情鏈接
此功能已被空間主人關閉
博客統計
點擊: 646042
帖子數量: 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

加西網為北美中文網傳媒集團旗下網站