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>
}
Run Code Online (Sandbox Code Playgroud)
有没有什么办法,明确内联函数一个函数中乙,同时明确未在函数内联相同功能的Ç?还是我完全受编译器的支配?
您完全受内联编译器的支配。
抛开部分不谈,是否使用inline函数完全是编译器最好做出的决定,您应该依靠它来做出最佳决定。