I received an interesting question from a reader. He used STL’s vector in a class that was heavily used in his project. The two compilers he used produced an extremely bloated executable file in debug mode. Although the release mode was much slimmer, he wondered what was causing this code bloat. It appears that the use ‘inline’ in vector’s operator [] increased the executable’s size dramatically. When he removed the inline specifier from vector’s operator [], his application size shrank significantly. There are two lessons from this story: if you discover that your application’s size is bloated, you should review all the occurrences of inline functions and change them to ordinary functions. Secondly, you should avoid the use of ‘inline’ unless you’re absolutely sure that it really improves performance rather than degrading it.

