At 02:30 PM 8/8/2003, Todd Niec wrote:
How does code warrior handle stack usage for unamed temporary variables?
I have a procedure that creates lots of unnamed temporary variables as a
result of conversion operators.  I can see that, in terms of
constructors
and destructors, these temporaries are being created and destroyed as
the
function executes, but the stack usage steadily increases and increases
as the function executes.  Eventually I run out of stack space.

CW allocates all temporaries on the stack at function entry time. However, there is a case where your stack usage can increase while your function is running -- the compiler defaults to deferring cleanup of the stack used for argument passing. If you've got a loop with a function call, using


#pragma stack_cleanup on

will cause the compiler to remove items from the stack as soon as a function returns.

--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com



-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to