Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 458 Bytes

File metadata and controls

27 lines (22 loc) · 458 Bytes

AC0001 intの乗算がlongに代入されています

Examples of patterns that are flagged by this analyzer

void Function(long v) { }
long v;
int N = 0;
v = 2 * N;
v = N * 2;
Function(2 * N);
Function(N * 2);

Solution

intlong にキャストするか long リテラルを使用してください。

void Function(long v) { }
long v;
int N = 0;
v = 2L * N;
v = (long)N * 2;
Function(2L * N);
Function((long)N * 2);