Skip to content
Tech News
← Back to articles

C's variable-size integers explained as portability feature, not flaw

read original get K&R The C Programming Language book → more articles
GoKawiil Brief

An educational retrospective on teaching C explains why types like int, short, and long have no fixed bit-width in the language specification. The author recounts how sizeof(int) returned 2 bytes on old 386 machines versus 4 bytes on most modern systems, and recommends students use the stdint.h header for fixed-width types like int8_t and uint16_t when consistent sizes are required.

Why It Matters

GoKawiil's interpretation of the reporting above, not reported fact.

The piece frames C's flexible integer sizing as a deliberate design choice that let the language run across wildly different historical hardware, including machines with 12, 18, 36, and 60-bit word sizes, rather than an oversight. This history could help explain to newer programmers coming from languages with fixed-size numeric types why C behaves unpredictably across platforms and why standardized headers like stdint.h became necessary for portable, modern code.

Key Takeaways
Worth a Look

K&R The C Programming Language book — This classic text is the definitive companion for understanding why C's integer types were designed to be flexible across different machine architectures rather than fixed. It's essential reading for anyone diving into portability quirks like sizeof(int) and word sizes discussed in the article. A must-have reference for serious C programmers working with retro or embedded systems.

See K&R The C Programming Language book on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.

Source: pikuma.com, 2026-09-25

Published there as: “C's Flexible Integer Sizes Were Not a Design Mistake”

Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.