Re: [閒聊] 真的有扯到...

看板Soft_Job作者 (.)時間12年前 (2012/03/28 21:02), 編輯推噓2(2014)
留言16則, 6人參與, 最新討論串4/13 (看更多)
: The parts of an expression containing && or || operators are evaluated only : until it’s known whether the condition is true or false. Thus, evaluation : of the express : ( gender == FEMALE ) && ( age >= 65 ) : stops immediately if gender is not equal to FEMALE (i.e., the entire : expression is false) and continues if gender is equal to FEMALE (i.e., : the entire expression could still be true if the condition age >= 65 is true). : This feature of conditional AND and conditional OR expressions is called s : hort-circuit evaluation. : ※ 編輯: icecastleo 來自: 111.243.0.134 (03/28 20:51) || 如果前者為真,可以省略後算,直接回傳為真 && 如果前者為偽,可以省略後算,直接回傳為偽 請搞清楚邏輯關係... 相反的 || 如果前者為偽,絕對不是像我同事說的,回傳為偽,省略後算 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.70.5.247

03/28 21:03, , 1F
扯= =
03/28 21:03, 1F
※ 編輯: erspicu 來自: 219.70.5.247 (03/28 21:03)

03/28 21:06, , 2F
同意,但這麼基本的問題...會不會是你同事一時口誤?
03/28 21:06, 2F

03/28 21:07, , 3F
我剛開始也覺得很扯 應該是口誤 但是他們後來很認真糾正我
03/28 21:07, 3F

03/28 21:07, , 4F
我就確定 真的是他們搞錯了
03/28 21:07, 4F

03/28 21:11, , 5F
就這句扯而已
03/28 21:11, 5F

03/28 21:12, , 6F
如果我是老闆,大概會叫他們走路了,基本中的基本中的基本
03/28 21:12, 6F

03/28 21:18, , 7F
這個不是基本嘛?
03/28 21:18, 7F

03/28 21:20, , 8F
印象中國中還是高中就有教最基本邏輯概念了 好神奇
03/28 21:20, 8F

03/28 21:23, , 9F
我其實滿反對 直接拿bitwise在if條件式中用的
03/28 21:23, 9F

03/28 21:25, , 10F
java很多自己亂取名字的method都塞進if條件式了,卻怕小小
03/28 21:25, 10F

03/28 21:26, , 11F
幾個bitwise op
03/28 21:26, 11F

03/28 21:27, , 12F
bitwise有它自己底層的意思 如果不了解編譯器行為
03/28 21:27, 12F

03/28 21:27, , 13F
或許未必會出錯 但是這是一知半解的
03/28 21:27, 13F

03/28 21:29, , 14F
以C/C++的人來說 會用bitwise的 大概是要求最佳速度化
03/28 21:29, 14F

03/28 21:30, , 15F
通常是高手比較會用 怎麼Java反來把bitwise使用視為當然
03/28 21:30, 15F

03/29 20:53, , 16F
我比較好奇原po公司是哪間XD
03/29 20:53, 16F
文章代碼(AID): #1FSmlb2C (Soft_Job)
討論串 (同標題文章)
文章代碼(AID): #1FSmlb2C (Soft_Job)