Simple Q

spamtrap_at_crayne.org
Date: 02/20/05


Date: Sun, 20 Feb 2005 21:28:09 +0000 (UTC)

All:

I have a basic question. I am using VC 6.0 and am looking at the stack
setup code for a standard C function (cdecl calling convenion) with the
following prototype:

void f();

The implementation is:

void f() { }

When I look at the stack set-up code in the disassembly, the standard
code is:

00401030 push ebp
00401031 mov ebp,esp
00401033 sub esp,40h

My question is, why the sub esp, 40h? This sets up 40h (64) bytes of
space on the stack, but there is nothing to put there -- no params, no
local vars. Why the allocation?

Thanks,
John



Relevant Pages

  • Re: Is C99 the final C? (some suggestions)
    ... > Dijkstra's weighted shortest path algorithms were nice for client-server based ... but the future is peer 2 peer. ... >>The C standard specifies what is UB and what's not. ... I can do no such thing with stack ...
    (comp.lang.c)
  • Re: Is C99 the final C? (some suggestions)
    ... > the standard? ... There doesn't have to be any mention of "stack" in what I try to ... "There are five standard signed integer types, ... standard-like language. ...
    (comp.lang.c)
  • Re: Toward a Forth thats easier to learn
    ... Because loops use the return stack. ... standard. ... portability. ... I'm saying that writing standard code demands new ...
    (comp.lang.forth)
  • Re: Why GCC does warn me when I using gets() function for accessing file
    ... standard does not define the term "variable". ... other people keep claiming -- that C doesn't have a stack (if function ... Where the analogy falls down, however, is that that above code can be ... but the standard *CANNOT* specify that guarantee. ...
    (comp.lang.c)
  • Re: [Lit.] Buffer overruns
    ... to retrieve from the stack. ... itself, "aha, I need to collect an int from the stack, so that'll ... The C Standard says, in 7.1.4: ... value outside the domain of the function, or a pointer outside ...
    (sci.crypt)