KaisenAmin/c_std logo

KaisenAmin/c_std

Free

Implementation of C++ standard libraries in C

FreeFree tier
Type
Open Source

About KaisenAmin/c_std

This project reimplements a large slice of the C++ Standard Library (containers, algorithms, smart pointers, …) together with many Python-style conveniences (statistics, random, secrets, json, regex, …) in pure C17. The goal is to give C developers familiar, well-documented building blocks — dynamic arrays, maps, strings, JSON, networking, big integers, and much more — without leaving the C ecosystem. The library is verified for zero memory leaks under Valgrind, cross-platform (Windows/Linux), and comes with 40+ modules including JSON, XML, CSV, networking, cryptography, arbitrary-precision math, and more. It offers familiar APIs modeled on C++ STL and Python standard library, and is heavily tested with deep per-module test suites.

Key Features

Zero memory leaks verified under Valgrind (--leak-check=full, --track-fds=yes)
Cross-platform support for Windows (MSVC/MinGW) and Linux (GCC/Clang)
Pure C17 with no C++ dependencies
40+ modules including containers, algorithms, strings, JSON, XML, CSV, networking, crypto, JWT, arbitrary-precision math, graphics, and more
Familiar APIs modeled on C++ STL (vector, map, unique_ptr) and Python standard library (random, statistics, json, regex, turtle)
Heavily tested with per-module test suites and runnable README examples with captured output
Fast, predictable data structures with O(1) average hashmap and O(log n) map
CMake build system supporting GCC, Clang, and MSVC with flexible module selection

Pros & Cons

Pros
  • Zero memory leaks guaranteed by Valgrind verification across all modules
  • Large collection of 40+ modules covering a wide range of functionality
  • Cross-platform out of the box (Windows and Linux)
  • Pure C17 with no C++ runtime or compiler dependency
  • Familiar APIs reduce learning curve for developers with C++ or Python background
  • Comprehensive test suites and runnable examples ensure reliability
  • Performance comparable to C++ STL for many operations (benchmarks provided)
Cons
  • Some containers (e.g., vector) up to 1.3× slower than C++ STL in specific benchmarks
  • Not as mature or extensively optimized as the C++ Standard Library
  • May lack certain advanced C++ features (e.g., exceptions, templates-based SFINAE)
  • Requires a C17-compatible compiler, which may limit support on very old systems

Best For

C developers needing STL-like containers and algorithms without switching to C++Building cross-platform applications with familiar APIs for strings, JSON, networking, and cryptographyCreating safe, memory-leak-free C programs with verified memory managementEducational projects demonstrating data structures and algorithms in pure C