[Question]activities of stack pointer and frame pointer when function called

A

anonymous

I'm new to programming c; and have few questions. hope could get
answers from here.
My question is ( I read some post) when a function called the frame
pointer would be pushed onto the stack and then the previously stack
pointer becomes the new frame pointer. I'm not very sure how? or you
can say i don't understand this activities at all. Therefore, I hope
someone, if possible, can give me more detail illustration (if please,
with pic is better; my english understanding is not very well; ) or
tell me where I am able to find the related resource.
I appreciate it, sincerely.
Jason
 
R

Raymond Martineau

I'm new to programming c; and have few questions. hope could get
answers from here.
My question is ( I read some post) when a function called the frame
pointer would be pushed onto the stack and then the previously stack
pointer becomes the new frame pointer. I'm not very sure how? or you
can say i don't understand this activities at all.

I'm not sure which posting you are referring to, but it certainly doesn't
look like the poster explained it correctly. It was also a case where the
poster was trying to describe assembly language on this newsgroup, which is
basically off-topic.
Therefore, I hope
someone, if possible, can give me more detail illustration (if please,
with pic is better; my english understanding is not very well; ) or
tell me where I am able to find the related resource.

You should take a look at the newsgroups referenced here:
http://www.ungerhu.com/jxh/clc.welcome.txt
 
R

Richard Bos

My question is ( I read some post) when a function called the frame
pointer would be pushed onto the stack and then the previously stack
pointer becomes the new frame pointer.

That depends on the implementation. If you just want to program in C,
you typically don't need to know how your implementation handles
function calls, as long as the result is in accord with the Standard.

Richard
 
S

S.Tobias

Stack frames and things are about how a function call is implemented
by a specific compiler, not necessarily a C compiler, and as such is OT
in clc. However, I believe that understanding these practical aspects
of life often helps better understand (the design of) a language itself
(...and people both from clc and csc as well). I hope a general answer
to this question is not much inappropriate here.

anonymous said:
I'm new to programming c; and have few questions. hope could get
answers from here.
My question is ( I read some post) when a function called the frame
pointer would be pushed onto the stack and then the previously stack
pointer becomes the new frame pointer. I'm not very sure how?

Your description doesn't make much sense.
Next time supply some pointers to the article you read, it'll be
easier to answer your query.
or you
can say i don't understand this activities at all.

I suspect you don't understand what as stack frame is.

First try to read:
http://en.wikipedia.org/wiki/Stack_frame
(this is not a particularly good description, but you have
to start somewhere).

Then try to google for web pages with these keywords:
stack frame function call convention

Then if you have more questions, come back here, and I'll prepare
a longer answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top