Awesome
awesome-c-preprocessor
<img src="meme.jpeg" width="400px">A list of awesome C preprocessor stuff
See also: "The Preprocessor Iceberg Meme".
Metaprogramming frameworks
- Hirrolot/metalang99 -- Full-blown preprocessor metaprogramming.
- boostorg/preprocessor -- Boost.org preprocessor module.
- boostorg/vmd -- Boost.org VMD module.
- rofl0r/order-pp -- order-pp preprocessor library (standalone part of chaos-pp).
- rofl0r/chaos-pp -- chaos preprocessor library. this is what boost preprocessor derived from.
- pfultz2/Cloak -- A mini-preprocessor library to demonstrate the recursive capabilities of the preprocessor.
- pfultz2/ZLang -- A plugin framework for namespace macros in C/C++.
- mcinglis/libpp -- Functional-programming macros for the C preprocessor.
- mcinglis/macrofun -- Standards-defying functional-programming macros for the C preprocessor.
- gustedt/p99 -- Macros and functions for C99.
- davidgarland/ceano -- A collection of C preprocessor hackery.
- twhitehead/c99-meta -- Abusing the C99 preprocessor for meta-programming.
- metacall/core/source/preprocessor -- Preprocessor Library by Parra Studios.
C language extensions
- Hirrolot/datatype99 -- Algebraic data types for C99.
- Hirrolot/interface99 -- Zero-boilerplate interfaces for C99.
- orangeduck/Cello -- Higher level programming in C.
- CObjectSystem/COS -- C Object System: a framework that brings C to the level of other high level programming languages and beyond.
- small-c/obj.h -- A single-header supports OOP in pure C.
- shakna-israel/LetsDestroyC.md -- Let's Destroy C.
- yulon/clofn -- A closure function implementation for C.
- alexanderchuranov/Metaresc -- META data and RESource library for C language.
- Leushenko/C99-Lambda -- Purely evil preprocessor macros adding anonymous functions and closures to ISO C99.
- Leushenko/Pyrite -- BASIC-style "compiler" as C syntax library.
- emdash/goof -- A toy functional language created through the abuse of C.
- Qqwy/c_exceptional -- A simple Exception-handling library for C99.
Compilers/Interpreters
- BlueFlo0d/CSP -- Compile-time LISP interpreter on C macro preprocessor.
- cospplredman/PPLISP -- A set of 45 macros that allow for lisp-like preprocessor meta programming.
- Ferdi265/preprocessor_brainfuck -- A brainfuck interpreter using only the C preprocessor.
- orangeduck/CPP_COMPLETE -- Brainfuck interpreter written in the C preprocessor.
- mkotha/bfi -- A brainfuck interpreter on the C preprocessor.
- notfoundry/bf.h -- Brainfuck interpreter written in the C preprocessor.
- notfoundry/ppasm -- x86_64 macro assembler entirely in C preprocessor.
Debuggers
- ptaffet/preprocessor-debug -- Observe how the C preprocessor expands your complicated macros.
- notfoundry/ppstep -- Interactive C/C++ preprocessor macro debugger.
- messer-cpp/messer -- REPL for C preprocessor of C++17.
Other projects
- mcpp -- A portable C preprocessor.
- swansontec/map-macro -- A recursive C preprocessor macro which performs an operation on each element of a list.
- M4GNV5/CppFun -- Math in the C pre-processor by breaking up Numbers into arrays of 8 bits and implementing common operations on those arrays.
- ramdeoshubham/macros -- A collection of commonly used C MACROS.
- agrif/Makefile -- A horrible, horrible, wonderful C Preprocessor hack library.
- notfoundry/wtf.c -- 4-bit ALU metaprogrammed in C11's _Generic.
- kcning/binom -- C macro that computes binominal coefficient at compile time.
- ldionne/cisp -- A C preprocessor library implementing object semantics.
- rofl0r/thread_wrapper -- A thread launcher wrapper macro which removes the boilerplate and allows to call any non-void function as a separate thread (needs BOOST preprocessor lib, which is C compatible).
- 18sg/uSHET -- A Malloc-Free SHET Client Library for Microcontrollers (
lib/cpp_magic.h
). - ScrimpyCat/CommonC -- Common utilities for C (
CommonC/Template.h
). - cher-nov/Gena -- Generic pseudo-templated containers for C. Written entirely in C89 with design inspired by the C++ STL.
- DiscordPP/discordpp and DiscordPP/plugin-native -- A modular Discord library and a module for it that use macros to define Discord API endpoints and objects.
Articles
- 7 Scandalous Weird Old Things About The C Preprocessor by Robert Elder.
- Coroutines in C by Simon Tatham.
- IOCC "Best abuse of the C preprocessor" by Immanuel Herrmann.
- Metaprogramming custom control structures in C by Simon Tatham.
- Advanced metaprogramming in C by Martin Sústrik.
- C/C++ Preprocessor Metaprogramming by Saad Ahmad.
- The Love/Hate Relationship with the C Preprocessor: An Interview Study by Flávio Medeiros, Christian Kästner, Márcio Ribeiro, Sarah Nadi, Rohit Gheyi.
- Outperforming LAPACK with C metaprogramming by Oleksandr Kaleniuk.
- C Pre-Processor Magic by Jonathan Heathcote.
Jens Gustedt's Blog
Link: https://gustedt.wordpress.com/category/c99/preprocessor/.
Some worth-noting articles:
- Handling control flow inside macros
- Scope Bound Resource Management with
for
Scopes - Detect empty macro arguments
- Default arguments for C99