gpt4 book ai didi

我可以部分/选择性地内联函数吗?

转载 作者:太空狗 更新时间:2023-10-29 17:24:29 25 4
gpt4 key购买 nike

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>
}

有什么方法可以显式地在函数 B 中内联函数 A 而在函数 not 中显式地内联相同的函数 A < em>C?还是我完全受制于我的编译器?

最佳答案

你完全受制于内联编译器的摆布。
撇开部分不谈,是否内联一个函数完全是编译器做出的最佳决定,您应该依靠它来做出最佳决定。

关于我可以部分/选择性地内联函数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10326792/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com