<分区>
嗨,我一直在阅读各种文档中的此类内容
register
Tells the compiler to store the variable being declared in a CPU register.
In standard C dialects, keyword register uses the following syntax:
register data-definition;
The
register
type modifier tells the compiler to store the variable being declared in a CPU register (if possible), to optimize access. For example,register int i;
Note that TIGCC will automatically store often used variables in CPU registers when the optimization is turned on, but the keyword register will force storing in registers even if the optimization is turned off. However, the request for storing data in registers may be denied, if the compiler concludes that there is not enough free registers for use at this place.
我的观点不仅仅是注册。我的观点是为什么编译器会将变量存储在内存中。编译器的任务就是编译并生成目标文件。在运行时发生实际的内存分配。为什么编译器会做这个生意。我的意思是,如果不通过编译文件本身来运行目标文件,内存分配是否会在 C 的情况下发生?