“注册"C中的关键字? [英] "register" keyword in C?

查看:27
本文介绍了“注册"C中的关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

register 关键字在 C 语言中有什么作用?我读过它用于优化,但在任何标准中都没有明确定义.它是否仍然相关?如果是,您将在什么时候使用它?

What does the register keyword do in C language? I have read that it is used for optimizing but is not clearly defined in any standard. Is it still relevant and if so, when would you use it?

推荐答案

这是对编译器的一个提示,即该变量将被大量使用,建议您尽可能将其保存在处理器寄存器中.

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.

这篇关于“注册"C中的关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆