BasicTypes.h file
BasicTypes provides simple typedefs and limits for fixed-width types and semantic-intention-communicating typedefs for various other types.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Enums
- enum CnxCompare { CNX_LESS_THAN = -1, CNX_EQUAL = 0, CNX_GREATER_THAN = 1 }
- Type signifying how a given value compares to another.
Typedefs
- using nullptr_t = void*
nullptr_tmakes usingNULLto represent a null pointer (aka anullptr) a first-class type of its own- using u8 = uint8_t
u8is a fixed-width 8 bit unsigned integer- using u16 = uint16_t
u16is a fixed-width 16 bit unsigned integer- using u32 = uint32_t
u32is a fixed-width 32 bit unsigned integer- using u64 = uint64_t
u64is a fixed-width 64 bit unsigned integer- using usize = size_t
usizeis the unsigned, platform-dependent type to represent a size- using byte = u8
- a
byteis an 8 bit unsigned integer - using i8 = int8_t
i8is a fixed-width 8 bit signed integer- using i16 = int16_t
i16is a fixed-width 16 bit signed integer- using i32 = int32_t
i32is a fixed-width 32 bit signed integer- using i64 = int64_t
i64is a fixed-width 64 bit signed integer- using isize = ssize_t
isizeis the platform-dependent type to represent a signed size. It is the signed alternative tousize- using f32 = float
f32is a 32-bit floating point number- using f64 = double
f64is a 64-bit floating point number- using CnxCompare = enum CnxCompare
- Type signifying how a given value compares to another.
- using u8_ptr = u8*
- alias for a
u8pointer - using u16_ptr = u16*
- alias for a
u16pointer - using u32_ptr = u32*
- alias for a
u32pointer - using u64_ptr = u64*
- alias for a
u64pointer - using usize_ptr = usize*
- alias for a
usizepointer - using i8_ptr = i8*
- alias for a
i8pointer - using i16_ptr = i16*
- alias for a
i16pointer - using i32_ptr = i32*
- alias for a
i32pointer - using i64_ptr = i64*
- alias for a
i64pointer - using isize_ptr = isize*
- alias for a
isizepointer - using f32_ptr = f32*
- alias for a
f32pointer - using f64_ptr = f64*
- alias for a
f64pointer - using const_u8_ptr = const u8*
- alias for a const
u8pointer - using const_u16_ptr = const u16*
- alias for a const
u16pointer - using const_u32_ptr = const u32*
- alias for a const
u32pointer - using const_u64_ptr = const u64*
- alias for a const
u64pointer - using const_usize_ptr = const usize*
- alias for a const
usizepointer - using const_i8_ptr = const i8*
- alias for a const
i8pointer - using const_i16_ptr = const i16*
- alias for a const
i16pointer - using const_i32_ptr = const i32*
- alias for a const
i32pointer - using const_i64_ptr = const i64*
- alias for a const
i64pointer - using const_isize_ptr = const isize*
- alias for a const
isizepointer - using const_f32_ptr = const f32*
- alias for a const
f32pointer - using const_f64_ptr = const f64*
- alias for a const
f64pointer - using cstring = char*
cstringrepresents a null-terminated legacy C-style string (aka achar*) and should be preferred when semantically referring to a string instead ofchar*to differentiate from references to a pointer to singlechar- using const_cstring = const char*
const_cstringrepresents a const null-terminated legacy C-style string (aka aconst char*) and should be preferred when semantically referring to a string instead ofchar*to differentiate from references to a pointer to singleconst char- using wcstring = wchar_t*
wcstringrepresents a null-terminated legacy C-style wide string (aka awchar_t*) and should be preferred when semantically referring to a wide string instead ofwchar_t*to differentiate from references to a pointer to singlewchar_t- using const_wcstring = const wchar_t*
const_wcstringrepresents a const null-terminated legacy C-style wide string (aka aconst wchar_t*) and should be preferred when semantically referring to a wide string instead ofconst wchar_t*to differentiate from references to a pointer to singleconst wchar_t- using char_ptr = char*
char_ptrrepresents a pointer to a singlecharand should be preferred when referring to a pointer to singlecharoverchar*to differentiate from references to a string- using const_char_ptr = const char*
const_char_ptrrepresents a pointer to a singleconst charand should be preferred when referring to a pointer to singleconst charoverconst char*to differentiate from references to a const string- using wchar_t_ptr = wchar_t*
wchar_t_ptrrepresents a pointer to a singlewchar_tand should be preferred when referring to a pointer to singlewchar_toverwchar_t*to differentiate from references to a wide string- using const_wchar_t_ptr = const wchar_t*
const_wchar_t_ptrrepresents a pointer to a singleconst wchar_tand should be preferred when referring to a pointer to singleconst wchar_toverconst wchar_t*to differentiate from references to a wide string-
using cstring_ptr = char_
ptr* - Alias for
char_ptr*. This should be preferred wherever possible when semantically referring to a pointer tocstring - using const_cstring_ptr = const char**
- Alias for
const char_ptr*. This should be preferred wherever possible when semantically referring to a pointer toconst cstring -
using wcstring_ptr = wchar_
t_ ptr* - Alias for
wchar_t_ptr*. This should be preferred wherever possible when semantically referring to a pointer towcstring - using const_wcstring_ptr = const wchar_t**
- Alias for
const wchar_t_ptr*. This should be preferred wherever possible when semantically referring to a pointer toconst wcstring -
using Ref = char_
ptr(char) - Alias for
char_ptrused for the inner type of reference-like types (ie iterators) -
using ConstRef = const_
char_ ptr(char) - Alias for
const_char_ptrused for the inner type of reference-like types (ie iterators) -
using wchar_t_ptr_ref = wchar_
t_ ptr* - Alias for
wchar_t_ptr*used for the inner type of reference-like types (ie iterators). This should be preferred when semantically referring to a reference to a pointer to a singlewchar_t -
using const_wchar_t_ptr_ref = const wchar_
t_ ptr* - Alias for
const wchar_t_ptr*used for the inner type of reference-like types (ie iterators). This should be preferred when semantically referring to a reference to a const pointer to a singlewchar_t
Defines
- #define CNX_BASIC_TYPES
- Declarations and definitions related to Cnx's builtin types.
- #define nullptr
nullptris aNULLpointer- #define CNX_OFORMAT_U8
u8decimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U16
u16decimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U32
u32decimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U64
u64decimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_USIZE
usizedecimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_UMAX
umaxdecimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_BYTE
bytedecimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_I8
i8decimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_I16
i16decimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_I32
i32decimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_I64
i64decimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_ISIZE
isizedecimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_IMAX
imaxdecimal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U8_OCT
u8octal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U16_OCT
u16octal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U32_OCT
u32octal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U64_OCT
u64octal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_USIZE_OCT
usizeoctal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_UMAX_OCT
umaxoctal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_BYTE_OCT
byteoctal format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U8_HEX
u8lower-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U16_HEX
u16lower-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U32_HEX
u32lower-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U64_HEX
u64lower-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_USIZE_HEX
usizelower-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_UMAX_HEX
umaxlower-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_BYTE_HEX
bytelower-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U8_HEX_UP
u8upper-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U16_HEX_UP
u16upper-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U32_HEX_UP
u32upper-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_U64_HEX_UP
u64upper-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_USIZE_HEX_UP
usizeupper-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_UMAX_HEX_UP
umaxupper-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_OFORMAT_BYTE_HEX_UP
byteupper-case hex format specifier for legacy formatted output functions (printf,fprintf, etc)- #define CNX_IFORMAT_U8
u8decimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U16
u16decimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U32
u32decimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U64
u64decimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_USIZE
usizedecimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_UMAX
umaxdecimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_BYTE
bytedecimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_I8
i8decimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_I16
i16decimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_I32
i32decimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_I64
i64decimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_ISIZE
isizedecimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_IMAX
imaxdecimal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U8_OCT
u8octal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U16_OCT
u16octal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U32_OCT
u32octal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U64_OCT
u64octal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_USIZE_OCT
usizeoctal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_UMAX_OCT
umaxoctal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_BYTE_OCT
byteoctal format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U8_HEX
u8lower-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U16_HEX
u16lower-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U32_HEX
u32lower-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U64_HEX
u64lower-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_USIZE_HEX
usizelower-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_UMAX_HEX
umaxlower-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_BYTE_HEX
bytelower-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U8_HEX_UP
u8upper-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U16_HEX_UP
u16upper-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U32_HEX_UP
u32upper-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_U64_HEX_UP
u64upper-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_UMAX_HEX_UP
umaxupper-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define CNX_IFORMAT_BYTE_HEX_UP
byteupper-case hex format specifier for legacy formatted input functions (scanf,fscanf, etc)- #define cnx_max_u8
- Maximum value of a
u8 - #define cnx_max_u16
- Maximum value of a
u16 - #define cnx_max_u32
- Maximum value of a
u32 - #define cnx_max_u64
- Maximum value of a
u64 - #define cnx_max_usize
- Maximum value of a
usize - #define cnx_max_i8
- Maximum value of an
i8 - #define cnx_max_i16
- Maximum value of an
i16 - #define cnx_max_i32
- Maximum value of an
i32 - #define cnx_max_i64
- Maximum value of an
i64 - #define cnx_max_isize
- Maximum value of an
isize - #define cnx_max_f32
- Maximum value of an
f32 - #define cnx_max_f64
- Maximum value of an
f64 - #define cnx_min_u8
- Minimum value of a
u8 - #define cnx_min_u16
- Minimum value of a
u16 - #define cnx_min_u32
- Minimum value of a
u32 - #define cnx_min_u64
- Minimum value of a
u64 - #define cnx_min_usize
- Minimum value of a
usize - #define cnx_min_i8
- Minimum value of an
i8 - #define cnx_min_i16
- Minimum value of an
i16 - #define cnx_min_i32
- Minimum value of an
i32 - #define cnx_min_i64
- Minimum value of an
i64 - #define cnx_min_isize
- Minimum value of an
isize - #define cnx_min_f32
- Minimum value of an
f32 - #define cnx_min_f64
- Minimum value of an
f64 - #define cnx_min_diff_f32
- Minimum discernible difference value of an
f32 - #define cnx_min_diff_f64
- Minimum discernible difference value of an
f64 - #define cnx_max_value(T)
- Returns the maximum possible value of the given type.
- #define cnx_min_value(T)
- Returns the minimum possible value of the given type.
Typedef documentation
typedef char_ ptrRef(char)
Alias for char_ptr used for the inner type of reference-like types (ie iterators)
type alias for a reference to CnxStringView
Alias for char_ptr* used for the inner type of reference-like types (ie iterators). This should be preferred when semantically referring to a reference to a pointer to a single char
Alias for f64_ptr* used for the inner type of reference-like types (ie iterators).
Alias for f32_ptr* used for the inner type of reference-like types (ie iterators).
Alias for isize_ptr* used for the inner type of reference-like types (ie iterators).
Alias for i64_ptr* used for the inner type of reference-like types (ie iterators).
Alias for i32_ptr* used for the inner type of reference-like types (ie iterators).
Alias for i16_ptr* used for the inner type of reference-like types (ie iterators).
Alias for i8_ptr* used for the inner type of reference-like types (ie iterators).
Alias for usize_ptr* used for the inner type of reference-like types (ie iterators).
Alias for u64_ptr* used for the inner type of reference-like types (ie iterators).
Alias for u32_ptr* used for the inner type of reference-like types (ie iterators).
Alias for u16_ptr* used for the inner type of reference-like types (ie iterators).
Alias for u8_ptr* used for the inner type of reference-like types (ie iterators).
Alias for wcstring* used for the inner type of reference-like types (ie iterators). This should be preferred wherever possible when semantically referring to a reference to wcstring
Alias for cstring* used for the inner type of reference-like types (ie iterators). This should be preferred wherever possible when semantically referring to a reference to cstring
Alias for f64_ptr used for the inner type of reference-like types (ie iterators)
Alias for f32_ptr used for the inner type of reference-like types (ie iterators)
Alias for isize_ptr used for the inner type of reference-like types (ie iterators)
Alias for i64_ptr used for the inner type of reference-like types (ie iterators)
Alias for i32_ptr used for the inner type of reference-like types (ie iterators)
Alias for i16_ptr used for the inner type of reference-like types (ie iterators)
Alias for i8_ptr used for the inner type of reference-like types (ie iterators)
Alias for usize_ptr used for the inner type of reference-like types (ie iterators)
Alias for u64_ptr used for the inner type of reference-like types (ie iterators)
Alias for u32_ptr used for the inner type of reference-like types (ie iterators)
Alias for u16_ptr used for the inner type of reference-like types (ie iterators)
Alias for u8_ptr used for the inner type of reference-like types (ie iterators)
Ref and ConstRef aliases for pointer types, used for the inner type of reference-like types (ie iterators), follow
typedef const_ char_ ptrConstRef(char)
Alias for const_char_ptr used for the inner type of reference-like types (ie iterators)
type alias for a const reference to CnxStringView
Alias for const char_ptr* used for the inner type of reference-like types (ie iterators). This should be preferred when semantically referring to a reference to a const pointer to a single char
Alias for const f64_ptr* used for the inner type of reference-like types (ie iterators).
Alias for const f32_ptr* used for the inner type of reference-like types (ie iterators).
Alias for const isize_ptr* used for the inner type of reference-like types (ie iterators).
Alias for const i64_ptr* used for the inner type of reference-like types (ie iterators).
Alias for const i32_ptr* used for the inner type of reference-like types (ie iterators).
Alias for const i16_ptr* used for the inner type of reference-like types (ie iterators).
Alias for const i8_ptr* used for the inner type of reference-like types (ie iterators).
Alias for const u8_ptr* used for the inner type of reference-like types (ie iterators).
Alias for const wcstring* used for the inner type of reference-like types (ie iterators). This should be preferred wherever possible when semantically referring to a reference to const wcstring
Alias for const cstring* used for the inner type of reference-like types (ie iterators). This should be preferred wherever possible when semantically referring to reference to const cstring
Alias for const_f64_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_f32_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_isize_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_i64_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_i32_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_i16_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_i8_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_usize_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_u64_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_u32_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_u16_ptr used for the inner type of reference-like types (ie iterators)
Alias for const_u8_ptr used for the inner type of reference-like types (ie iterators)