Question

Simple question, need an answer quickly please!

Take this situation on a 32-bit machine:

Unsigned long long n = 1;
n -= 2;

I know on a 64-bit machine, this would wrap around to the highest unsigned long long. But what would happen on a 32-bit machine, since the long long is stored as two separate words?

Thank you!

Était-ce utile?

La solution

If the implementation is conforming, then the same: it will correctly wrap around. I assume this is C; The C standard requires this behavior independently from the implementation details.

Autres conseils

A 64 bit integer datatype behaves the same on all architectures, including 32 bit. If not, programming would be quite hard, wouldn't it?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top