0

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!

Jason Block
  • 155
  • 1
  • 3
  • 9

2 Answers2

1

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.

1

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

Lindydancer
  • 25,428
  • 4
  • 49
  • 68