On Sunday, 19 October 2014 at 09:56:44 UTC, Ola Fosheim Grøstad wrote:
In C++ you should default to int and avoid uint unless you do bit manipulation according to the C++ designers.

There are three reasons: speed, portability to new hardware and correctness.

Speed: How so?

Portability: One issue to keep in mind is that C works on *tons* of hardware. C allows hardware to follow either two's complement, or one's complement. This means that, at best, signed overflow can be implementation defined, but not defined by spec. Unfortunately, it appears C decided to outright go the undefined way.

Correctness: IMO, I'm not even sure. Yeah, use int for numbers, but stick to size_t for indexing. I've seen too many bugs on x64 software when data becomes larger than 4G...

Reply via email to