Quote:
-> Inline Functions
Bad: inline functions explicitly increase code size to the benefit of performances due to less stack manipulation required.
Quote:
-> Virtual Functions
No impact at best, actually it increases the code size a bit due to the virtual tables needing space.
Quote:
-> Unused variables removal
Unless they are statics it does not change code size but the memory footprint of the application when running. Good but not for what you want to achieve.
Quote:
-> Moving local variables to the inner most scope
What for? A variable declaration
does not increase code size, only memory footprint. Inside a function ALL the variables are memorized in the stack. At best, with very specialized compilers, you earn a stack address reuse to minimize runtime memory footprint.
To minimize code size you should:
* Eliminate all unneeded static libraries.
* Reduce the call paths and the number of intermediate objects in the hierarchy.
* If possible, with functions having multiple signatures, using only a single one of them in order to not have the other variants linked at compile time. Careful: a single missed function will add its variant to the linked file.
* See if your cross platform framework has options (usually in form of #defines) to eliminate most of th marshalling and intermediate calls when compiled for a specific MCU. Cross platform frameworks are great but they do increase code size.
* Eliminate any huge library like boost, which is fantastic but bloated.
These are my 2 cents,
Denis