Technologies
Back
Software Development & Open Source

Why int in C does not mean 32 bits, and a byte is not always 8 bits

Habr
Advertisement468 × 90
Why int in C does not mean 32 bits, and a byte is not always 8 bits

This article explores the historical reasons why the C language standard does not define a fixed size for data types like int or byte. The author explains that in the 1970s, computer architectures were extremely diverse, and the language creators aimed to ensure maximum code portability across different systems, including machines with 16-bit or 36-bit words. The material covers the evolution of these concepts from the origins of C to the modern C23 standard. Although sizeof(int) most often returns 4 today, the lack of a strict bit-count binding is a deliberate architectural decision rather than a design flaw. The article invites readers to delve into the history of computing to understand why these language features remain relevant today, providing flexibility when working with diverse hardware.

This is a summary. Read the full article at the original source:

Habr
Advertisement468 × 90
Share
Software Development & Open Source

Related stories

Advertisement970 × 250