Something about C++ binary [closed]

Well, it is pretty hard to tell what you were actually expecting, but running it through the compiler generates lots of useful warnings. If you add long long integral literal sigils all over the place, like so:

#include <iostream>

using namespace std;

int main()
    long long num = 0x7fffffff00000000ULL >> 32;
    for(int i=63;i>=0;--i)

    return 0;

You get the answer


which is what I would expect your loop to do. I have no idea what you expected num to do, as you didn’t use the value, but hey! I decorated that too.

Does that answer your question?

Leave a Comment