Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: All
May 15, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Avoiding Code Bloat Caused by Inline

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.
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date