Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's not exactly what you're looking for, but clang can give you record dumps of C and C++ structs and classes. (In general, clang has lots of interesting tooling for C and C++, and I highly recommend looking into using it).

I wrote here [1] about using it in a KDE program (KStars) to cut 10% off the memory usage. In particular you can also use this tool to see some of the many bad effects of deeply nested classes: your class may be 8-byte aligned, so a 'char' at the end can take up eight bytes with padding, and it's not possible (AFAIK) to rearrange fields up and down inheritance heirarchies [2].

[1]: http://www.hdevalence.ca/blog/2013-12-22-better-living-throu...

[2]: C++ is not my favorite programming language.



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

Search: