在C和C ++中,激活记录是什么? [英] What is activation record in the context of C and C++?

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

问题描述

对于C / C ++程序员来说,这意味着什么以及了解它的重要性?

What does it mean and how important to know about it for a C/C++ programmers?

在各个平台上,至少在概念上是否相同?

Is it the same across the platforms, at least conceptually?

我理解它是一个分配的内存块,用于通过函数存储局部变量...

I understand it as a block of allocated memory used to store local variable by a function...

我想要了解更多信息

推荐答案

激活记录是堆栈框架的另一个名称。构成调用栈的数据结构。它通常由以下组成:

An activation record is another name for Stack Frame. It's the data structure that composes a call stack. It is generally composed of:


  • 被叫方的本地地址

  • 将地址返回给主叫方

  • 被叫方的参数

因此,调用堆栈由任意数量的激活记录组成,

The Call Stack is thus composed of any number of activation records that get added to the stack as new subroutines are added, and removed from the stack (usually) as they return.

元素的实际结构和顺序是平台,甚至定义了实现,通常是在新子例程返回时将它们添加到栈中。

The actual structure and order of elements is platform and even implementation defined.

对于C / C ++程序员来说,这种结构的常识对于理解某些实现功能(如调用约定)以及为什么缓冲区溢出很有用。允许运行第三方恶意代码。

For C/C++ programmers, general knowledge of this structure is useful to understand certain implementation features like Calling Conventions and even why do buffer overflows allow 3rd party malicious code to be ran.

更多的熟悉的知识将进一步推动上述概念,并允许程序员调试其应用程序并即使没有调试器或调试符号,也可以读取内存转储。

A more intimate knowledge will further the concepts above and also allow a programmer to debug their application and read memory dumps even in the absence of a debugger or debugging symbols.

通常,C / C ++程序员可以在业余爱好编程生涯的大部分时间里干活,甚至不花一会儿时间。

More generally though, a C/C++ programmer can go by a large portion of their hobbyist programming career without even giving the call stack a moments thought.

这篇关于在C和C ++中,激活记录是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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