Chapter 8: Portable and Modern C
Sections 81--90 C code must run everywhere. Auto makes portability the default, not the exception.
C's greatest strength is its portability. The same C code can compile on Linux, macOS, Windows, and embedded systems. But achieving true portability requires understanding platform differences -- endianness, word size, threading APIs, and compiler extensions.
Auto generates portable C code by default. The a2c transpiler handles platform-specific concerns so you can focus on your program's logic. This chapter covers the C portability landscape and how Auto simplifies it.
81. C Standards Timeline
C has evolved through several standards, each adding features while maintaining backwards compatibility:
C89/C90 -- The foundation. ANSI standardized C in 1989, ISO in 1990. This is the "classic" C that every compiler supports. Functions must be declared before use, variables must be declared at the top of a block, and // comments are not standard.
C99 -- Modernized C. Added // comments, mixed declarations and code, <stdint.h> for fixed-width integers, variable-length arrays, and designated initializers.
C11 -- The concurrency update. Added _Static_assert, _Generic, <threads.h>, atomic operations, and alignment specifiers. This is what Auto targets.
C17/C23 -- Refinements and new features. C23 adds typeof, constexpr, auto type inference, and improved attribute syntax.
Auto generates C11-compatible code, which gives broad compiler support while including modern features like _Static_assert and <stdatomic.h>.