Warning c4307 integral constant overflow in C

I have this operation (8 * (512 * 786432)), and the product is 3221225472

I tried to use it with variables like longlong, unsigned long

But the compiler will give me an error

c4307 integral constant overflow

and I need a result to use it with functions, how can I fix it? or which variables can work for large numbers?

considers

+4
source share
2 answers

(8 * (512 * 786432)) int 32- . long , . , .

long x = (8L * (512L * 786432L));

L , long.

, long - 64-, , Windows. LL ( i64) Windows.

+16

(8 * (512ull * 786432)) 
+5

Source: https://habr.com/ru/post/1524797/


All Articles