icecream-cpp icon indicating copy to clipboard operation
icecream-cpp copied to clipboard

Comparison with dbg-macro

Open dufferzafar opened this issue 2 years ago • 5 comments

I'm used to the Python icecream library and really like this style of printf based debugging.

While looking for C++ based library, I found this repo & another one: https://github.com/sharkdp/dbg-macro

Are you aware of it? Any comparison between the two? which features one supports & the other doesn't etc?

dufferzafar avatar Jun 30 '22 19:06 dufferzafar

I'll try to list the ones that I notice:

  • dbg has colors, ic doesn't
  • dbg prints context (file & func name) by default (not sure if there's a way to turn it off), ic can also print context
  • dbg adds type of the argument as well, ic doesn't
  • dbg.h issues a warning when included so we remember to remove it - nice touch!

@sharkdp, any more differences b/w these two libs?

dufferzafar avatar Jun 30 '22 19:06 dufferzafar

Also found this: https://github.com/eerimoq/dbg-macro

Which has a backtrace macro.

dufferzafar avatar Jun 30 '22 19:06 dufferzafar

I was not aware of dbg-macro until now. Nice library, thank you point it out! I definitively will take some ideas and inspirations from it.

renatoGarcia avatar Jul 31 '22 15:07 renatoGarcia

About the features differences, beyond the ones that you have cited I would put that Icecream has support for printing wide characters, can print structs without iostream<< overload using Clang's __builtin_dump_struct, and wraps and format long lines before printing.

That from a quick look at dbg-macro. Maybe it can do more things that I'm not aware.

renatoGarcia avatar Jul 31 '22 16:07 renatoGarcia

can print structs without iostream<< overload using Clang's __builtin_dump_struct

Oh cool, I didn't know about that :+1:

sharkdp avatar Aug 04 '22 19:08 sharkdp