Principle:ClickHouse ClickHouse Fundamental Type Aliases
| Knowledge Sources | |
|---|---|
| Domains | Data_Types, Core |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Standardized type names that provide consistency and clarity across a codebase.
Description
Large projects benefit from consistent type naming. ClickHouse defines standard aliases (Int8/UInt8/Int16/etc.) used throughout the codebase. These aliases improve clarity (Float64 vs double), enable platform-specific choices (UInt8 = char8_t for strict aliasing), and allow future changes (like using _BitInt(8) for Int8). Consistent types also simplify code generation and type dispatch.
Usage
Use as the standard types in large projects to maintain consistency, improve code clarity, and enable codebase-wide type changes.
Theoretical Basis
Type Aliases: C++ `using` declarations create aliases without creating new types.
Strict Aliasing: Using char8_t for bytes enables better optimizer reasoning about aliasing.
Bit-Precise Types: `_BitInt(N)` creates integers of exactly N bits, useful for Int8 to match signed semantics.
Portability: Explicit-width types (uint32_t) ensure consistent sizes across platforms.