dimanche 13 décembre 2020

Strange overflow assigning 2 * 1024 * 1024 * 1024

void main()
{
    long long ll = 2 * 1024 * 1024 * 1024; 
    unsigned long long ull = (2 * 1024 * 1024 * 1024);
    std::cout << ll << "\n" << ull;
}

My output with Visual Studio 2019 is

 -2147483648
18446744071562067968

I have no idea why overflow is happening here, please help

Aucun commentaire:

Enregistrer un commentaire