Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: dbg.h: C macro for quick and dirty print debugging (github.com/j-m0)
9 points by J-M0 10 months ago | hide | past | favorite | 2 comments



This is my first public project in C. Feedback is welcome!

While working on another project, I was inspired by Rust's `dbg!`[1] macro which simply prints and returns the result of an expression. What started as a little, one line `#define` quickly turned into a decent amount of nested macros to generate functions and a dash of `_Generic` which was actually quite fun to get working.

I'm putting this out there in the hopes that it will be useful.

[1] https://doc.rust-lang.org/std/macro.dbg.html


Hey, very useful. Thanks! Similar to ic() for python, but with the nice ability to be used inline.

https://github.com/gruns/icecream




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: