unstdalias is a lightweight C library that provides type aliases for common C types, enhancing code readability and portability. This single-header library defines standard types like byte, u8, i8, and many more, simplifying type management in C projects.
- Comprehensive Type Aliases: Covers integers, floating-point types, character types, and utility types.
- Single-Header Simplicity: Easy to integrate into any C project.
- Cross-Platform Compatibility: Built with Meson for seamless portability.
Clone the repository and build with Meson:
git clone https://github.com/0keeper1/unstdalias.git
cd unstdalias
meson setup build
meson compile -C build- Create a
subprojectsdirectory. - Add
unstdalias.wrapin thesubprojectsfolder with the following content:
[wrap-git]
url = https://github.com/0keeper1/unstdalias.git
revision = master- Update your
meson.buildfile:
unstdalias = subproject('unstdalias')
unstdalias_dep = unstdalias.get_variable('unstdalias_dep')- Include the header file in your C project:
#include "unstdalias.h"- 8-bit:
byte,u8,i8 - 16-bit:
u16,i16 - 32-bit:
u32,i32 - 64-bit:
u64,i64 - 128-bit (GCC/Clang only):
u128,i128
- 8-bit:
fi8,fu8 - 16-bit:
fi16,fu16 - 32-bit:
fi32,fu32 - 64-bit:
fi64,fu64
usize: Unsigned size typeiptr: Signed integer pointer typeptr: Unsigned integer pointer typemaxi: Maximum signed integer typeumaxi: Maximum unsigned integer type
f32: Single precision (32-bit)f64: Double precision (64-bit)f128: Quadruple precision (128-bit)
wchar: Wide character typewint: Wide integer type for I/O
-
__asm__: Redefines__asm__toasm, enabling inline assembly in C code. -
wstring: Defines a wide character string structure:cap: Total allocated size in bytes.pointer: Pointer to the wide character array.len: Length of the string excluding the null terminator.
-
string: Defines a standard C string structure:cap: Total allocated size in bytes.pointer: Pointer to the character array.len: Length of the string excluding the null terminator.
This project is licensed under the MIT License.
Contributions are welcome! Feel free to open issues or submit pull requests.