什么堆和堆栈意味着C ++? [英] what do heap and stack mean in C++?

查看:173
本文介绍了什么堆和堆栈意味着C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听到这些话扔了很多,但我不明白他们在 c ++ 。有人告诉我在标准中查找它,但在索引没有提到堆栈或heap,只有堆栈展开不说堆栈是什么。

I hear these words thrown around a lot but I don't understand what they mean in c++. Somebody told me to look it up in the standard but in the index there's no mention of "stack" or "heap", only stack unwinding which doesn't say what the stack is.

这些概念是否存在于C ++中?

Do these concepts exist in C++?

推荐答案

b

我听说这些话扔了很多...

I hear these words thrown around a lot ...

是的,这些广泛使用来自于误解和坚持不适当的术语,将硬件和操作系统概念与编程语言实现混合。

Yes, these are widely used coming from misconception and sticking to inappropriate terminologies, mixing hardware and OS concepts with the programming language implementation.


这些概念是否存在于C ++中?

Do these concepts exist in C++?

只要您将称为动态存储持续时间堆栈作为自动存储持续时间,c ++标准没有任何关于这些特定术语的概念,但使用其他。所以没有。

As long you're referring to "heap" as dynamic storage duration, and "stack" as automatic storage duration, the c++ standard doesn't have any notion of these particular terms, but uses the other ones. So no.

请注意,没有区分本地变量,全局变量或参数的自动存储持续时间。

Note there's no differentiation of automatic storage duration for local variables, global variables or parameters.

实际完成的工作被认为是实现细节,实际上取决于目标CPU架构和操作系统环境。

How's that actually done is considered an implementation detail, and in fact is dependent on the target CPU architecture and OS environment.

要完成答案(这就是为什么我说只要你指的是...):

To complete the answer (that's why I said "As long you're referring to ..."):

提供 std :: stack 的概念,

但是这些引用了数据结构,并且与如何实现任何类型实例的内存分配无关。

The c++ standard library actually provides concepts for a std::stack and a heap.
But these refer to data structures, and aren't related to how memory allocation for any type instances is implemented.

这篇关于什么堆和堆栈意味着C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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