سؤال

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!

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top