Zig supports arbitrary-width integers from 0 to 65,535 bits for both signed and unsigned types, unlike C's fixed set. The language enforces strict explicitness: no implicit conversions or silent truncation. Overflow is caught at runtime in debug mode, with options for wrapping or saturating arithmetic, plus standard library functions and built-in overflow-returning tuples. Memory alignment still applies outside packed structures — a 24-bit integer takes 32 bits unless placed in a packed struct, where exact bit sizes are guaranteed. This makes packed structs ideal for network packets and hardware registers. Zig also provides `@sizeOf` and `@bitSizeOf` builtins to inspect actual vs. logical sizes.

3m watch time

Sort: