|
|
|
|
|
by jiggawatts
129 days ago
|
|
I would recommend outright copying Rust. Among other things, it's a systems programming language and hence its naming scheme is largely (if not entirely) compatible with modern C++ types. I.e.: +----------------+-------------------------+------------------------------+
| Rust | Modern C++ | Notes |
+----------------+-------------------------+------------------------------+
| i8 | std::int8_t | exact 8-bit signed |
| u8 | std::uint8_t | exact 8-bit unsigned |
| i16 | std::int16_t | exact 16-bit signed |
| u16 | std::uint16_t | exact 16-bit unsigned |
| i32 | std::int32_t | exact 32-bit signed |
| u32 | std::uint32_t | exact 32-bit unsigned |
| i64 | std::int64_t | exact 64-bit signed |
| u64 | std::uint64_t | exact 64-bit unsigned |
| i128 | (no standard type) | GCC/Clang: __int128 |
| u128 | (no standard type) | GCC/Clang: unsigned __int128 |
| isize | std::intptr_t | pointer-sized signed |
| usize | std::uintptr_t | pointer-sized unsigned |
| f32 | float | IEEE-754 single precision |
| f64 | double | IEEE-754 double precision |
| bool | bool | same semantics |
| char | char32_t | Unicode scalar value |
+----------------+-------------------------+------------------------------+
|
|