Activation Record from C / C++

44 views
Skip to first unread message

Rohit Jog

unread,
Jul 3, 2008, 5:15:01 AM7/3/08
to C/C++ Users' Group
Can some one explain the in depth stack management?
Functions are available in almost all languages: when we call a
function one activation record is pushed on to the stack!

How can we access this stack from C / C++?

Zaman

unread,
Jul 3, 2008, 5:15:54 PM7/3/08
to C/C++ Users' Group
To get in-depth explanation of activation-record management get
'compilers' by aho ullman and sethi. C++ and C by design don't allow
you to modify the activation record.

Rohit Jog

unread,
Jul 4, 2008, 3:57:12 AM7/4/08
to C/C++ Users' Group
So does that mean from C/C++ i cannot push dummy record on to the
stack?

Sandeep Mahapatra

unread,
Jul 4, 2008, 11:05:43 AM7/4/08
to c-cp...@googlegroups.com
hi Rohit,
You can push a dummy record onto a stack using a function call, but you cannot manipulate the stack in C++. I mean, like in assembly language programming u know the address of the stack segment and hence can easily work with the stack, modifying the activation records and all.
But C++ doesnot provide a way to do that.

Maybe i'm wrong, but i dont know any technique to access the stack in C++. If somebody knows, i'll really appresiate his/her help.

manav

unread,
Jul 26, 2008, 12:58:42 PM7/26/08
to C/C++ Users' Group
can we use ASM keyword to include assembly lang instructions into the
code...
it hink it can work..
correct me if i'm wrong

On Jul 4, 8:05 pm, "Sandeep Mahapatra" <sandyisc...@gmail.com> wrote:
> hi Rohit,
> You can push a dummy record onto a stack using a function call, but you
> cannot manipulate the stack in C++. I mean, like in assembly language
> programming u know the address of the stack segment and hence can easily
> work with the stack, modifying the activation records and all.
> But C++ doesnot provide a way to do that.
>
> Maybe i'm wrong, but i dont know any technique to access the stack in C++.
> If somebody knows, i'll really appresiate his/her help.
>

Arindam

unread,
Jul 26, 2008, 6:03:40 PM7/26/08
to c-cp...@googlegroups.com
On 7/26/08, manav <manven...@gmail.com> wrote:
>
> can we use ASM keyword to include assembly lang instructions into the
> code...
> it hink it can work..
> correct me if i'm wrong

Of course you can - that's what ASM is for? But the OP is asking if
you can use C/C++ to capture the activation record. I am not sure
where this requirement comes from but a short answer is no.

Cheers.

>
> On Jul 4, 8:05 pm, "Sandeep Mahapatra" <sandyisc...@gmail.com> wrote:
> > hi Rohit,
> > You can push a dummy record onto a stack using a function call, but you
> > cannot manipulate the stack in C++. I mean, like in assembly language
> > programming u know the address of the stack segment and hence can easily
> > work with the stack, modifying the activation records and all.
> > But C++ doesnot provide a way to do that.
> >
> > Maybe i'm wrong, but i dont know any technique to access the stack in C++.
> > If somebody knows, i'll really appresiate his/her help.
> >
> > On Fri, Jul 4, 2008 at 1:27 PM, Rohit Jog <rohitjo...@gmail.com> wrote:
> >
> > > So does that mean from C/C++ i cannot push dummy record on to the
> > > stack?
> >
> >
>
> >
>


--
A. It messes the natural order in which we read.
Q. What's with it?
A. Top-Posting,
Q. What is the most annoying thing on emails and posts.

Reply all
Reply to author
Forward
0 new messages