Basic / Arithmetic Types
BoolInt,UInt,ByteFloat
Width-Specified Types
| Signed | Unsigned | Float |
|---|---|---|
Int8 |
UInt8 |
|
Int16 |
UInt16 |
|
Int32 |
UInt32 |
Float32 |
Int64 |
UInt64 |
Float64 |
Integer
Int is
Int64(like in Swift and Go) on virtually all modern systems,Int32on systems with a 32-bit address bus only (i.e. old/small platforms, like Win32/x86),Int16on systems with a 16-bit address bus (i.e. very old/small microcontrollers like AVR/ATmega328/Arduino Uno, 6502, Z80).
Simply use Int,
- not
,Size, norSSize,PtrDiff - not
norLong.LongLong
Boolean
It is Bool, not nor bool.Boolean
Byte
Byte is std::byte, i.e. not the same type as UInt8 for parameter overloading.
It is used to represent raw memory, for binary buffers, serialization, or low-level I/O.
Floating Point
Float is
Float64/ double precision (like in Python, unlike C/C++).Float32on old/small platforms only (i.e. those with hardware support forFloat32but not forFloat64).
With modern processors double precision is very fast.
When concerned with memory bandwidth, cache size, and SIMD performance, choose one of the smaller floating-point types like Float32
or (if available) BFloat16, Float16, Float8, maybe even Float4.