pfultz2/Cloak logo

pfultz2/Cloak

Free

A mini-preprocessor library to demostrate the recursive capabilites of the preprocessor

FreeFree tier
Type
Open Source

About pfultz2/Cloak

A miniature C/C++ header-only library that demonstrates the recursive capabilities of the C preprocessor, showcasing how macro expansion can be made Turing-complete. Intended purely as an educational exposition; the author recommends using the more robust chaos-pp library for production work. The repository includes the core header 'cloak.h' and a test file 'test.h'.

Key Features

Demonstrates recursive macro expansion in the C/C++ preprocessor
Small, header-only library (cloak.h)
Illustrates Turing-completeness of the C preprocessor
Lightweight educational tool for preprocessor metaprogramming
Accompanied by a test file and GitHub repository with 985+ stars

Pros & Cons

Pros
  • Educational: clearly demonstrates recursive preprocessor capabilities
  • Lightweight: small codebase easy to study
  • Open source under permissive license (MIT implied)
  • Well-documented for its purpose with clear exposition
  • Active community interest (985 stars on GitHub)
Cons
  • Not intended for production use; author recommends chaos-pp instead
  • Limited practical utility beyond demonstration
  • No official releases or package management support
  • Only relevant for developers working with C/C++ preprocessor metaprogramming

Best For

Learning how recursive macro expansion works in C/C++Understanding the theoretical limits of the C preprocessorTeaching advanced preprocessor techniques in computer science coursesExperimenting with Turing-tarpit metaprogramming

FAQ

What is Cloak?
Cloak is a miniature C/C++ preprocessor library that demonstrates the recursive capabilities of the preprocessor, showing how it can be made Turing-complete. It is purely for exposition, not production.
Is Cloak ready for production use?
No. The author explicitly states that for production, users should adopt chaos-pp, which is 'superior in every way'.
What are the system requirements?
A C or C++ compiler with a standard preprocessor conforming to C99 or later. The library is header-only and requires no additional dependencies.
How can I get started?
Clone the GitHub repository (pfultz2/Cloak) and include 'cloak.h' in your project. Refer to the test file 'test.h' for examples of macro usage.