mirror of
https://github.com/github/codeql.git
synced 2026-05-24 08:07:07 +02:00
7 lines
312 B
C++
7 lines
312 B
C++
int i = 2000000000;
|
|
long j = i * i; //Wrong: due to overflow on the multiplication between ints,
|
|
//will result to j being -1651507200, not 4000000000000000000
|
|
|
|
long k = (long) i * i; //Correct: the multiplication is done on longs instead of ints,
|
|
//and will not overflow
|