PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   七嘴八舌異言堂 (https://www.pcdvd.com.tw/forumdisplay.php?f=12)
-   -   程式運算指派 =+ (https://www.pcdvd.com.tw/showthread.php?t=1067596)

@"@ 2015-01-07 04:17 PM

程式運算指派 =+
 
運算指派
有+=

那=+怎樣看

micall.lee 2015-01-07 04:21 PM

引用:
作者@"@
運算指派
有+=

那=+怎樣看

有這個嗎?

27681049 2015-01-07 04:27 PM

除了要考倒(混淆)別人之外,別寫這種自己都不確定的程式碼.

darkangel 2015-01-07 04:32 PM

+= 對 C 熟手來說是很平常的東西。
但是我從沒看過 =+。

Adsmt 2015-01-07 04:32 PM

就 +<number>

ex. a =+ 1 等於 a= +1 等於 a = + 1

=+ 在一般compiler會視為個別的符號。

Drow 2015-01-07 04:36 PM

引用:
作者@"@
運算指派
有+=

那=+怎樣看

a += b ==> a = a + b
a =+ b ==> a = b

micall.lee 2015-01-07 04:42 PM

引用:
作者Drow
a += b ==> a = a + b
a =+ b ==> a = b



我看別亂搞了,明明就是丟到 Compiler 會有錯誤或者其它出乎意料的結果

那就不要硬是還要給一個意義,免得讓別人誤以為說我寫程式可以寫這種東西

27681049 2015-01-07 04:42 PM

xcode 6.1.1
...
int i;

i = 1;
i =+ 1;
...

i 的值還是為 1
但是xcode給警告
Use of unary operator that may be intended as compound assignment (+=)

Adsmt 2015-01-07 04:45 PM

引用:
作者micall.lee
我看別亂搞了,明明就是丟到 Compiler 會有錯誤或者其它出乎意料的結果
那就不要硬是還要給一個意義,免得讓別人誤以為說我寫程式可以寫這種東西

http://www.tutorialspoint.com/codingground.htm

我試了幾種程式語言,沒發現有什麼問題。但這種寫法確實沒意義。

signally 2015-01-07 04:48 PM

這好像以前考計算機概論有看過
典型的考試會考∼現實中幾乎不會用到的範例XD


所有的時間均為GMT +8。 現在的時間是12:24 AM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。