From: deleveld AT my-deja DOT com Newsgroups: comp.os.msdos.djgpp Subject: question about stack frames Date: Thu, 30 Dec 1999 15:07:50 GMT Organization: Deja.com - Before you buy. Lines: 52 Message-ID: <84frs6$l3h$1@nnrp1.deja.com> NNTP-Posting-Host: 192.87.23.66 X-Article-Creation-Date: Thu Dec 30 15:07:50 1999 GMT X-Http-User-Agent: Mozilla/4.7 [en] (Win95; I) X-Http-Proxy: 1.0 x39.deja.com:80 (Squid/1.1.22) for client 192.87.23.66 X-MyDeja-Info: XMYDJUIDdeleveld To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello Everyone, I have a question about DJGPP and stack frames. I am working on a recursive function that has to recursive quite a few times and I'd like to be able to calculate how many times the function can recurse without overflowing the stack. My function is like this: static void _draw_recursive(Window* const window, const ExposeEvent* const rect) { ExposeEvent *event; Window* ptr = window->higher; ... do some stuff with the arguments and local variables ... } Now I have already tried to reduce the amount and size of local variables. i.e. I need an Expose event and I malloc and free a pointer in the function instead of making it a local varaible. What confuses me is when I look at the assembler output for the function I see this: __draw_recursive: subl $44,%esp pushl %ebp pushl %edi pushl %esi pushl %ebx movl 64(%esp),%eax ... some other stuff ... It looks to me like there are $44 bytes reserved on the stack when I am pretty sure that I need a lot less that that. I calculate that I need at most 4 pointers i.e. 16 bytes. Can anyone explain this do me? Any advice on making the stack frame as small as possible? Thanks you, Doug Eleveld Sent via Deja.com http://www.deja.com/ Before you buy.