The function is placed in the code, rather than being called, similar to using macros (conceptually)
This can improve speed (no function call), but causes code bloat (if the function is used 100 times, you now have 100 copies)
You should note this does not force the compiler to make the function inline, and it will ignore you if it thinks its a bad idea. Similarly the compiler may decided to make normal functions inline for you.
This also allows you to place the entire function in a header file, rather than implementing it in a cpp file (which you cant anyways, since then you get an unresolved external if it was declared inline, unless of course only that cpp file used it).
No comments:
Post a Comment