gpt4 book ai didi

c - `register` 在 GStreamer 中做什么

转载 作者:行者123 更新时间:2023-11-30 17:32:47 28 4
gpt4 key购买 nike

我正在阅读一些 gstreamer 代码并落在了这一行

register int i;

有谁知道 register 是什么?关键字有吗?

最佳答案

Another SO question已经回答过这个问题了。

布莱恩·诺布劳赫的回答:

It's a hint to the compiler that the variable will be heavily used and that you recommend it be kept in a processor register if possible.

Most modern compilers do that automatically, and are better at picking them than us humans. :-)

因此,本质上,它向程序员保证编译器将知道该变量将被多次使用并将该变量保留在 CPU 寄存器中。正如另一个答案中所述,大多数编译器会自动执行此操作。

关于c - `register` 在 GStreamer 中做什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24000571/

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