精華區beta C_and_CPP 關於我們 聯絡資訊
※ 引述《aoc90058 (我是新警察Orz...)》之銘言: : in Expressions 5:4: 'Between the previous and next sequence point a scalar : object shall have its stored value modified at most once by the evaluation of : an expression. Furthermore, the prior value shall be accessed only to : determine the value to be stored.' : But fortunately, there's a simple way to avoid it: Never write code that does : things it shouldn't do between sequence points, like try to write into the : same int, or other built-in scalar value, more than once in the same : expression." f(i++, i);-> undefined /* 沒什麼人會這樣搞自己 */ a[i++] = i;-> undefeind /*常有人這樣寫*/ 都錯在 "Furthermore, the prior value shall be accessed only to dterminie the value to be stored (i)" 同理 p = z++ + z;-> undefined. /* @@ 考題 */ 第二個 z 不是用來存 z *q++ = *p++ -> defined. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.217.28.95