Yet Another TypeSafe and Generic Programming Candidate for C

https://news.ycombinator.com/rss Hits: 5
Summary

MisraStdC A modern C11 library designed to make programming in C less painful and more productive, written in pure C. MisraStdC provides generic containers, string handling, and formatted I/O inspired by higher-level languages while maintaining C's performance and control. Disclaimer: This library is not related to the MISRA C standard or guidelines. The name "MisraStdC" comes from the author's name, Siddharth Mishra, who is commonly known as "Misra" among friends. Table of Contents Features Cross-platform compatibility : Supports MSVC, GCC, and Clang : Supports MSVC, GCC, and Clang Type-safe generic containers : Vec(T) : Generic vector with strict type checking Str : String handling (specialized Vec(char) ) Map(K, V) : Generic key-value hash-map storage (WIP) Int : Custom big integer implementation (WIP) : Rust-style formatted I/O : WriteFmt , ReadFmt : Type-safe formatted standard I/O StrWriteFmt , StrReadFmt : Type-safe formatted string operations : JSON parsing and serialization Memory safety with proper initialization and cleanup functions Requirements C11 compatible compiler : GCC : Version 4.9 or newer Clang : Version 3.4 or newer MSVC : Visual Studio 2019 or newer Build System : Meson build system (version 0.60.0 or newer) Ninja build tool Installation Building from Source # Clone the repository with submodules git clone --recursive https://github.com/brightprogrammer/MisraStdC.git cd MisraStdC # Configure the build meson setup builddir # Build the library ninja -C builddir # Run tests ninja -C builddir test Build Options For development with sanitizers (recommended for debugging): meson setup builddir -Db_sanitize=address,undefined -Db_lundef=false Documentation Comprehensive API documentation is available at docs.brightprogrammer.in. Concepts Initialization If an object type provides an Init() method or macro, then that must necessarily be used. Some objects employ tricks to detect whether object is initialized properly or is corrupted at runtime. These ch...

First seen: 2025-09-09 15:57

Last seen: 2025-09-09 20:05