Petr Skocik
Petr Skocik

Reputation: 60068

Practical portability of exact-width integers

7.20.1.1p3 mentions that exact-width integers ({u,}int{8,16,32,64}_t) are optional.

How will it practically limit the portability of my software if I use them?

(I'm particularly interested in supporting machines running Linux, Windows, or Mac OS.)

Upvotes: 1

Views: 79

Answers (2)

Petr Skocik
Petr Skocik

Reputation: 60068

So what I found out:

and from https://en.wikipedia.org/wiki/Word_(computer_architecture) it seems one can pretty much count on hardware support for 8-bit, 16-bit, and 32-bit integers (but not necessarily 64-bit integers) on machines made since about 1978.

Upvotes: 2

Bathsheba
Bathsheba

Reputation: 234695

As a very good rule of thumb, the exact width integers are fully supported by any machine with a CPU using 2's complement signed types.

You'll do well to find an exception. Some mainframes and cash registers might use 1's complement and the even rarer signed magnitude scheme. You might find it difficult to get your code running on such machines, but then, would you want it to?

Upvotes: 2

Related Questions