简体   繁体   English

C ++调用堆栈不符合标准?

[英]C++ call stack not in standard?

Does the C++ standard talk about the call stack? C ++标准是否讨论了调用堆栈? It's common knowledge how stack and heap are used in C++, but I was reading through the standard and found no mention of it. 众所周知,如何在C ++中使用堆栈和堆,但是我在阅读该标准时并未提及它。

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf

Is this something that's left up to the compiler implementation, but everyone agrees on, or did I miss something while browsing the doc? 这是由编译器实现决定的,但所有人都同意吗?或者在浏览文档时错过了什么?

It isn't mentioned in the standard. 标准中未提及。 Neither the stack nor the heap are. 堆栈和堆都不都是。 The standard describes the syntax and the semantics(the behavior) of C++ programs. 该标准描述了C ++程序的语法和语义(行为)。 The implementations choose to implement it as they wish. 实现选择根据需要实现它。

However when you see how calls to functions must behave, there isn't a really wide choice. 但是,当您看到对函数的调用必须如何行为时,没有一个真正广泛的选择。 There has to be some sort of a stack to store local variables! 必须有某种堆栈来存储局部变量!

The standard talks about storage duration instead of stack and heap. 该标准讨论的是存储持续时间,而不是堆栈和堆。 How those are implemented is up to ... implementation. 如何实现这些取决于...实施。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM