I wrote and use regularly similar macros for C, oriented towards minimal context.<p>They are less advanced on some areas, but more advanced on some.<p>For example, they do not depend on C11 generic feature, which is an advantage on the many non-C11 platforms (like 8-bit-targeting compiler SDCC).<p>On the strong side:<p>* log any expression: `somemacro(foo.bar())` will log `foo.bar() = 42`
* compile-time global enable/disable
* compile-time debug level threshold<p>I've been planning to share that for a moment.<p>Some working parts are used on <a href="https://github.com/cpcitor/color-flood-for-amstrad-cpc/blob/master/log.h" rel="nofollow">https://github.com/cpcitor/color-flood-for-amstrad-cpc/blob/...</a><p>It will eventually appear on <a href="https://github.com/fidergo-stephane-gourichon?tab=repositories" rel="nofollow">https://github.com/fidergo-stephane-gourichon?tab=repositori...</a><p>I also wrote similar macros for C++ mentioned on <a href="https://news.ycombinator.com/item?id=21071367" rel="nofollow">https://news.ycombinator.com/item?id=21071367</a>