Drawing the line on inline
Posted Jan 6, 2006 16:42 UTC (Fri) by giraffedata
Parent article: Drawing the line on inline
Not mentioned in the article is one important and often overlooked fact about inlining: Inlining happens automatically. This is just about forced inlining. Even without the "inline" keyword, Gcc will inline a function if it looks beneficial. I think current versions have a way to explicitly exclude a function from inlining.
So one really should use "inline" only where one has reason to believe he's smarter than Gcc, and forced inlining should always be respected.
One other reason to use "inline" is where you use that warning option that warns you about unused functions. If you put a function in a header file, since not every file that includes the header file will use that function, you get that warning if you don't declare "inline".
to post comments)