堆栈如何增长 [英] How the stack grows

查看:58
本文介绍了堆栈如何增长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



大家好,


在CI中听到堆栈从上到下逐渐堆积从底部堆积到

top 。

编译器依赖吗?

解决方案

deepak说:


>

大家好,


在CI中听到堆栈从上到下堆积并从底部堆积到

top。

编译器依赖吗?



C不要求编译器使用堆栈。如果编译器/使用

堆栈,它使用什么样的堆栈完全取决于它。它甚至不需要从上到下或从下到上增长(例如,它可能是作为动态分配的堆栈帧的链表实现的


任意地址)。


-

Richard Heathfield

Usenet是一个奇怪的地方 ; - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上述域名中, - www。


deepak写道:


大家好,


在CI中听到堆栈从上到下逐渐堆积,从底部堆积到

top。

是编译器依赖吗?



如果你看一下gcc源代码,你应该找到它是如何调查

是否存在一个明显的堆栈,以及它的增长方式。据推测,

代码在标准C之外做事.gcc接受引导编译器使用的系统

。一个成功的gcc构建显示你已经有多个编译器可以共享相同的方案(由硬件/操作系统实现的一个

)。


Tim Prince< tp ***** @nospamcomputer.orgwrote:


deepak写道:


在CI中听到堆栈从上到下堆积并从底部堆积到

顶部。是编译器依赖吗?



如果你看一下gcc源码,你应该找到它如何调查是否有明显的堆栈,以及它的增长方式。据推测,

代码在标准C之外做事.gcc接受引导编译器使用的系统

。一个成功的gcc构建显示你已经有多个编译器可以共享相同的方案(由硬件/操作系统实现的一个

)。



相反,一个编译器可以使用不同的方案。


Richard



Hi All,

In C I heard the stack grows from top to bottom and heap from bottom to
top.
Is it compiler depend?

解决方案

deepak said:

>
Hi All,

In C I heard the stack grows from top to bottom and heap from bottom to
top.
Is it compiler depend?

C doesn''t require the compiler to use a stack. If the compiler /does/ use a
stack, what kind of stack it uses is entirely up to it. It needn''t even
grow from top to bottom or bottom to top (for example, it may be
implemented as a linked list of dynamically allocated stack frames with
arbitrary addresses).

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.


deepak wrote:

Hi All,

In C I heard the stack grows from top to bottom and heap from bottom to
top.
Is it compiler depend?

If you look at gcc source, you should find how it investigates whether
there is an apparent stack, and which way it grows. Presumably, that
code is doing things outside standard C. gcc accepts the system
employed by the bootstrap compiler. A successful gcc build shows you
already that more than one compiler can share the same scheme (the one
implemented by the hardware/OS).


Tim Prince <tp*****@nospamcomputer.orgwrote:

deepak wrote:

In C I heard the stack grows from top to bottom and heap from bottom to
top. Is it compiler depend?

If you look at gcc source, you should find how it investigates whether
there is an apparent stack, and which way it grows. Presumably, that
code is doing things outside standard C. gcc accepts the system
employed by the bootstrap compiler. A successful gcc build shows you
already that more than one compiler can share the same scheme (the one
implemented by the hardware/OS).

And also, conversely, that one compiler can work with different schemes.

Richard


这篇关于堆栈如何增长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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