Can I embed a function partially / selectively?

void run_hot(void) { // I am called very often! serve(); // <more code here> } void run_cold(void) { // I am called only occasionally! serve(); // <more code here> } ???inline??? void serve(void) { // I only want to be called inline from hot functions! // <more code here> } 

Is there a way to explicitly embed function A into function B without explicitly inserting the same function A into function C? Or am I completely at the mercy of my compiler?

+6
source share
1 answer

You are completely at the mercy of the inlaid compiler.
Leave aside partially, regardless of whether the inline function is the only solution that the compiler makes best, and you must rely on it to make the best decision.

+4
source

Source: https://habr.com/ru/post/914186/


All Articles