teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追記

2018/11/04 10:03

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -6,4 +6,14 @@
6
6
  暗黙の型変換が働くので、つまり次のように書いているのと同じです。
7
7
  ```C++
8
8
  cout << labs(static_cast<long>(a - b)) << endl;
9
- ```
9
+ ```
10
+
11
+ 追記
12
+ ---
13
+ 規格書を見る限り、実装依存であるようです。
14
+ > **Integral conversions**
15
+ ...
16
+ If the destination type is signed, the value is unchanged if it can be represented in the destination type;
17
+ otherwise, the value is implementation-defined.
18
+
19
+ 引用元: N4659 [conv.integral]