研究Ç轉換我發現了一個約整數促銷款,我沒有很明白,它說:關於整數促銷
"Integer types smaller than int are promoted when an operation is performed on them. If all values of the original type can be represented as an int, the value of the smaller type is converted to an int; otherwise, it is converted to an unsigned int"
考慮到:
的任何無符號整數類型的等級等於對應的有符號整數類型的等級
long long int的等級大於long int的等級,該等級大於int的等級,該等級大於short int的等級,該等級大於signed char的等級。
問題是: 爲什麼小於int的類型不應該用int表示? 以及爲什麼無符號整數可以表示int不應該表示的值?
在此先感謝。
你想知道爲什麼有人會更喜歡比int更短的東西嗎? – kevin628 2012-04-26 15:29:32