Dの整数オーバーフローを検出する方法は?(キャリーフラグをチェックしますか?)
元の例:
ubyte a = 100;
ubyte b = 200;
ubyte c = a + b;
// c can't represent 300; how to detect the overflow now?
改訂例:
uint a = 2_000_000_000;
uint b = 3_000_000_000;
uint c = a + b;
// c can't represent 5_000_000_000; how to detect the overflow now?
また、乗算とプリ/ポストインクリメントを使用します。