What is the meaning of stable interface ?

Hi,

I was going through isocpp guidelines and came across a guideline for inlining functions here : https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f5-if-a-function-is-very-small-and-time-critical-declare-it-inline

The Exception Section says :
Exception : Do not put an inline function in what is meant to be a stable interface unless you are certain that it will not change. An inline function is part of the ABI.

I have following queries regarding the above statement :
[1] What is the meaning of "stable interface" ?
[2] What exactly is the meaning of above exception with reference to inlining the functions ? I am not able to comprehend what above exception states.

Thanks for any help :)
If you write a library you are providing an interface for the users of your library to program against. This is essentially what you put in the header file. A "stable interface" would be an interface that does not break existing code when the library is updated (e.g. the implementation changes or things are added to the interface).

If a user dynamically links to your library it is possible for him to update the library without recompiling his own code. Unfortunately this does not work for inline functions, because they would instead have been embedded into the user's code and would not get updated properly unless the user recompiles his own code.
Last edited on
Got it Peter87. Thank you :)
Topic archived. No new replies allowed.