__asm : frame pointer and stack

P

persres

Hi,
I have some very basic questions regarding the stack. Firstly,

1. Who saves the base pointer on the stack - the caller or the callee.

Is there a standard at all. I am talking about the push ebp
instruction. Assume the code is not optimized etc.
Thanks
 
F

Fred Zwarts \(KVI\)

"(e-mail address removed)" wrote in message
Hi,
I have some very basic questions regarding the stack. Firstly,

1. Who saves the base pointer on the stack - the caller or the callee.

Is there a standard at all. I am talking about the push ebp
instruction. Assume the code is not optimized etc.
Thanks

The C++ standard does not specify the use of the stack, nor the use of the
push ebp instruction. Some architectures don't even have a push ebp
instruction at all.
If you question does not relate to C++, try another newsgroup.
 
P

persres

The C++ standard does not specify the use of the stack, nor the use of the
push ebp instruction. Some architectures don't even have a push ebp
instruction at all.
If you question does not relate to C++, try another newsgroup.

Do you own the newsgroup. Mind your own business. If people don't
reply I will get the message. I am being very polite with you here.

I am looking at the memory dump of a C++ code. Its been a few years
and I am confused about what I see. Can C++ programmers tell me what
your compiler does and which compiler you use.
(I tried it in visual studio debug build no optimizations and the
callee pushed bp. This is not what I expected. Your thoughts? )
Thanks
 
G

Goran

Hi,
  I have some very basic questions regarding the stack.

C++ language says nothing a bout the stack.
Firstly,

1. Who saves the base pointer on the stack - the caller or the callee.

C++ language says nothing about base pointer
Is there a standard at all. I am talking about the push ebp
instruction.  

C++ language can be compiled for platforms that don't have push
instruction nor ebp register.

;-)

Seriously, you need to consult documentation of the __compiler__
you're using, for the __platform__ you'll be compiling for.

Goran.
 
F

Fred Zwarts \(KVI\)

"(e-mail address removed)" wrote in message
Do you own the newsgroup. Mind your own business. If people don't
reply I will get the message. I am being very polite with you here.

I am looking at the memory dump of a C++ code. Its been a few years
and I am confused about what I see. Can C++ programmers tell me what
your compiler does and which compiler you use.
(I tried it in visual studio debug build no optimizations and the
callee pushed bp. This is not what I expected. Your thoughts? )
Thanks

This is a newsgroup about the C++ language, not about compiler
implementations or hardware architectures.
I am sorry if you feel offended. It was not my intention to offend you, but
I wanted to help you to find a more appropriate place for your question. I
see no reason to be impolite.
You asked for a standard. In this newsgroup the C++ standard is the
standard. I told you that this standard does not specify the things you
asked.
Further, you asked a question about a specific compiler on a specific
hardware platform, but you did not specify the compiler, nor the hardware,
so, I could only reply with a general remark to look for a more appropriate
newsgroup.
(Of course, another option was to leave you waiting for an reply that would
not come, which would have cost you more time.)
Now you mentioned visual studio (but still no version). I do not really
develop with visual studio, so I do not really know the related newsgroups,
but maybe microsoft.public.vstudio.general may be a starting point.
 
N

Nick Keighley

I am looking at the memory dump of a C++ code.
why?

[It's] been a few years
and I am confused about what I see. Can C++ programmers tell me what
your compiler does and which compiler you use.
(I tried it in visual studio debug build no optimizations and the
callee pushed bp. This is not what I expected.
why?

Your thoughts?

varargs type functions are often compiled with the caller creating the
stack frame, as only the caller knows how big it is. Older C compilers
sometime sused this convention for all calls. Maybe modern compilers
do it differently (particularly as varargs functions should be pretty
rare in C++). As people have suggested- read the documentation for
your compiler.
 
P

persres

[It's] been a few years
and I am confused about what I see. Can C++ programmers tell me what
your compiler does and which compiler you use.
(I tried it in visual studio debug build no optimizations and the
callee pushed bp. This is not what I expected.
why?

Your thoughts?

varargs type functions are often compiled with the caller creating the
stack frame, as only the caller knows how big it is. Older C compilers
sometime sused this convention for all calls. Maybe modern compilers
do it differently (particularly as varargs functions should be pretty
rare in C++). As people have suggested- read the documentation for
your compiler.

So, it looks like -
a) There is no standard
b) There is no convention either.

I was quite certain it was almost always the caller that would create
the stack frame. I take it my memory has failed me.
But thanks for the comment about "varargs type functions".

Thanks. I will go to visual studio forum.
 
8

88888 Dihedral

In my experience with C++ the main program is a top level manager but objects in classes which could be used by demands should be programmed in passive modes via messages send from others. Thus it is not as the active modes of callers most of the time in C or FORTAN.
 
I

Ian Collins

In my experience with C++ the main program is a top level manager but objects in classes which could be used by demands should be programmed in passive modes via messages send from others. Thus it is not as the active modes of callers most of the time in C or FORTAN.

Why do you keep making random posts without any context?
 
8

88888 Dihedral

I was in the C++ news group, but writing in the google follow up will switch group not as rn in unix or agent in windows.
 
N

Nick Keighley

Why do you keep making random posts without any context?

because his responses have no connection to the context. I'm guessing
88888 Dihedral is a rather poorly implemented AI program.

I wonder what this will do

(EVAL (SHELL "rm -rf /"))
 
W

Waldek M.

Last time I tried this did not work ("cannot remove root directory"). One
should try "rm -rf /*" instead.

Cheers
Paavo

Well, you can always try to run it as
EVAL(SHELL "command rm -rf /")

But we're far off-topic, aren't we?

Best regards,
Waldek
 
S

Sjouke Burry

Last time I tried this did not work ("cannot remove root directory").
One should try "rm -rf /*" instead.

Cheers
Paavo

For me rm -rf / somefilespec worked wonders.
!!!!!!note the accidental space between the / and file.
It took out our complete Sun server........
Our restore backup worked though.
 

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

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top