第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

array[j + 1] = array[j--]; 這個語句有問題么?

array[j + 1] = array[j--]; 這個語句有問題么?

C++
慕工程0101907 2019-03-15 17:45:13
int j; ... ...array[j + 1] = array[j--];array[j + 1] = array[j--]是否一定等價于array[j + 1] = array[j]; j--;?
查看完整描述

2 回答

?
慕娘9325324

TA貢獻1783條經(jīng)驗 獲得超4個贊

C++17之前是UB。C++17確定了順序:賦值操作符的右側操作數(shù)先序于左側。所以左側得到的是自減后的值。故而array[j + 1] = array[j--];一般等價于(并發(fā)例外)

array[j] = array[j];
--j;
8.18.1[expr.ass] ...In all cases, the assignment is sequenced after the value computation of the right and left operands, and before the value computation of the assignment expression. The right operand is sequenced before the left operand...


查看完整回答
反對 回復 2019-03-15
?
慕標琳琳

TA貢獻1830條經(jīng)驗 獲得超9個贊

array[j + 1] = array[j--]; 屬于未定義行為。
兩個順序點之間訪問和修改了同一個對象。

查看完整回答
反對 回復 2019-03-15
  • 2 回答
  • 0 關注
  • 1144 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號