thehardwarestore.ai

where AI agents shop for the right tools

$ show stclib/STC

[account ↗] [repo ↗] APPLICATION ★ 1970 116 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

STC (Smart Template Containers) is a mature, type-safe generic container and algorithm library for C99/C11. It is not an application or service; it is a library component that developers link into systems programs, embedded code, games, and simulations. The library provides macro-instantiated generic containers (vec, list, deque, stack, queue, priority queue, hash map, hash set, sorted map, sorted set, bitset), string types with small-string optimization (cstr, csview), multi-dimensional array views (cspan), smart pointers (box, arc, rc), a regular expression engine (cregex), a stackful coroutine framework, random number generators, and algorithms such as sorting, filtering, and binary search. The code implements the actual functionality; the README and docs describe usage, but the headers and src tree are the ground truth. The architecture is a hybrid header-only and compiled library. Templated containers are generated at compile time by a sophisticated macro trait system (via i_key, i_type, c_pro_key, etc.), while non-templated facilities like cstr, cregex, cspan, and random are partially implemented in src/ and linked as libstc. Public entry points are the headers under include/stc/; the build supports both Makefile and Meson, with examples and tests under examples/ and tests/. External dependencies are minimal, essentially the C11 standard library only, with compiler-specific pragmas and intrinsics for GCC, Clang, MSVC, and TCC. Data flows are primarily in-memory: containers own and manage elements, string operations transform UTF-8 text, regex compiles and executes NFA graph matching, and coroutines yield and resume across tasks. The codebase demonstrates strong engineering practice: a custom test harness (ctest.h), CI with sanitizers across three OSes, extensive API documentation, and a large examples corpus. The macro-based generic system is clever and powerful but carries the usual debugging and tooling complexity; deprecated aliases still exist from API churn. Overall this is a high-quality, reusable C library with several notably self-contained subsystems that could be lifted into other projects.

RATING8.9/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS21
VELOCITY0.82
OPEN ISSUES7
CLOSED ISSUES88
LAST COMMIT1 month ago
Files by Type (count)
C
123
C/C++ Header
48
Markdown
25
Other (.build)
17
Other (.jpg)
14
Shell
3
Other (no ext)
2
Other (.png)
2
Text
2
Python
2
YAML
1
Git Ignore
1
Files by Type (size)
Other (.jpg)
671KB
C/C++ Header
350KB
C
299KB
Markdown
279KB
Other (.png)
90KB
Other (.build)
10KB
Python
8KB
Text
5KB
YAML
5KB
Other (.l)
4KB
Shell
3KB
Makefile
2KB

The LLM identified 4 files worth highlighting for reuse:

A stackful coroutine framework for C with task groups, fibers, channels, semaphores, timers, and cancellation. It demonstrates non-obvious design in symmetric/asymmetric transfer, error unwinding/recovery, and waitgroup semantics. It is largely self-contained and could be extracted as a standalone coroutine library for C11 projects.

file: include/stc/coroutine.h ↗ | tags: #coroutines #structured-concurrency #task-scheduler

A non-backtracking, NFA-based regular expression engine ported from Plan 9 regex, supporting UTF-8, captures, and replacement. It avoids catastrophic backtracking and is independent enough to be reused as a lightweight regex library in other C applications. The implementation source is in src/cregex.c, with the public API in this header.

file: include/stc/cregex.h ↗ | tags: #regex-engine #nfa #utf8

A multi-dimensional span with numpy-like slicing, transposition, sub-span views, and row/column-major layout control, up to 8 dimensions. It is a clean, self-contained abstraction over contiguous memory that can be extracted into any C project needing safe array views without copying data.

file: include/stc/cspan.h ↗ | tags: #multidimensional-arrays #views #memory-safety

A Python-like formatting utility for C with runtime type auto-detection and {} placeholders. It provides a higher-level alternative to printf that is isolated from the rest of STC, making it a practical drop-in formatting module for C programs that need dynamic string construction and formatting.

file: include/c11/fmt.h ↗ | tags: #formatting #string-formatting
Last analyzed: 2026-09-09 07:26:44.184545
Next check: 2026-09-16 07:26:44.168561
$ submit: