Hacker GitHub

← All repos

pfultz2/Cloak

View on GitHub ↗ ★ 989 C

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

10 mentions on Hacker News by 8 people: 3 stories, 7 comments · first 2013-06-27 · latest 2026-03-28

Mentions per year 10 mentions · busiest year 2023 (2)
20082026
  1. …other preprocessors let you do that using builtins which are fast and easy to grok. See for example https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,... Poor C preprocessor performance has a negative real world impact, for…
    comment by skissane · 2024-09-03 · in Greppability is an underrated code metric
  2. …WHEN(IS_PAREN(args))(EXPAND(EXPAND args))) #define NO_ARGS Where cloak.h is https://github.com/pfultz2/Cloak/blob/master/cloak.h The above macros are admitttedly very hairy. If C had a better preprocessor, but was otherwise unchanged,
  3. …end up unintentionally upsetting some people with it. [0] https://github.com/scallyw4g/poof [1] https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,...
  4. Well, mostly I use idioms from the Cloak Wiki ( https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,... ). It takes some time to realise them :)
    comment by Hirrolot · 2021-02-04 · in Datatype99: C99 with Sum Types, v0.1.0
  5. …it. Regardless, here's a link that seems to cover this and other somewhat more obscure techniques: https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,...
    comment by yoklov · 2016-02-29 · in C preprocessor tips and tricks
  6. …an excellent guide on recursion in macros, see this article on how to abuse the C pre-processor: https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,... . In the end I end up defining structs like this: SERIALIZER_STRUCT(…
  7. …x = y; \ y = x##y; \ } Also, you can be tricky and "co-recurse" in macros, which is explained here: https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,... Regarding each-it, I think its pretty doable in C. Right off the top of my…
    comment by tolmasky · 2014-09-15 · in Comparative Macrology