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".
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds