Christopher Hunt wrote:
> A question concerning the stack_cleanup pragma
> Can the pragma's scope apply only to a whole file, all files (common 
> header) and/or function body i.e. can its scope be varied?
> [JK's] email implied that it was only for common headers

I think that pragma works like most others in CW, which is covered under
"Pragma Scope" in the IDE online help.  It actually says they >don't<
work from inside a precompiled header, though they might work in a
regular (non precompiled) header.  This online help talks about the
pragma scope ending at the end of the file, though I think they really
mean "translation unit", which is the source file with all the non
precompiled includes expanded by the preprocessor.

You almost certainly >don't< want this stack cleanup globally.  That
would greatly inflate and slow your code where not needed.

So you should be able to use "#pragma stack_cleanup on" above the
specific function(s) you want, followed by "#pragma stack_cleanup reset"
after the function(s).

But if you have any doubt about what it's really doing, use the IDE
"Disassemble" command and verify it does the cleanup you want.

-slj-

Reply via email to