gpt4 book ai didi

c++ - 操作系统循环变量堆栈问题

转载 作者:太空宇宙 更新时间:2023-11-04 15:51:40 26 4
gpt4 key购买 nike

cout << "blah blah blah";
for (int i=0; i < n; i++)
{
cout << '#' << endl;;
}
cout << "blah blah blah";

栈帧中的整数 i 是什么?如果整数只能在循环中使用,操作系统如何跟踪哪些变量只能在循环中使用,而不能在整个函数中使用?

最佳答案

操作系统与它没有任何关系——这是编译器的工作。

任何体面的系统都会将 i 保存在 cpu 寄存器中

关于c++ - 操作系统循环变量堆栈问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7265864/

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