Hacker News new | ask | show | jobs
by salgernon 761 days ago
When I need to refactor a large C codebase the first thing I do is recompile it with C++ - and then fix the missing prototypes and other grit that gets in the way. The cost to do this is minimal but I then have more options (via macros, automatic assignment, etc) to start shoring it up like a retaining wall that's about to fail. At the end of the day, a POD C++ structure with const inline accessors is way easier to reason about and costs nothing once compiled. It probably helps that I started with CFront, so C++ is just C (and C is just assembler with macros.)