3 ms·
As an embedded C++ developer, exit-time destructors have bit me many times. In many cases, they pull in 100+ kB of useless code that only runs on exit. I've on
by ooterness 3y ago
As an embedded C++ developer, exit-time destructors have bit me many times.
In many cases, they pull in 100+ kB of useless code that only runs on exit. I've only got 128 kiB of RAM and my program doesn't exit, but good luck convincing the compiler this is true. It's so aggravating.
- roeles 3y agoRecent tests with link time optimization give me the impression that code which is not actually called is not included (or even resolved). If you can convince the compiler that the destructor is never called, it might not include it.
- ooterness 3y agoYes, that's correct. Assuming "-ffunction-sections" is set during compilation, and "--gc-sections" is set during linking, it'll drop any unreachable code. Sadly, small oversights (e.g., exception handling for undefined virtual methods) can cause disproportionate bloat.