Lennart Thelander wrote:
For quite many functions/Procedures, I get two warnings: warning: frame size too large for reliable stack checking warning: try reducing the number of local variables
Say what? Reducing the number of local variables? Here's an example:
PROCEDURE TTextEditItem.HandleKey(VAR theEvent:EventRecord); VAR i : SInt16; pt : Point; theChr : Char; theKey : SInt16; shift : BOOLEAN; option : BOOLEAN; control : BOOLEAN; command : BOOLEAN; lineHeight, ascent : SInt16; theStyle : TextStyle;
I say that's a small amount of (small) local variables, so how can there be too many?
The word "number" is a bit misleading, it's actually about the total size. Perhaps TextStyle is a larger structure here. It might also be an implicit temporary variable created by the compiler. E.g., some string and set operations need them.
And what is a "frame"
The space on the stack to contain the local variables, parameters etc. of a routine call.
and how can I reduce its size?
If it's an explicit variable, you could make it a pointer (though you might not want to for good reasons). For implicit variables, you cannot do this easily without rewriting the code.
Or better: How do I allow for a larger frame size?
AFAIK, on affected platforms (mainly Mac OS X), it cannot be changed. However, the warning only refers to the stack checking option, i.e., the code with the larger frame size will work fine by itself, just without stack checking.
See also: http://www.gnu-pascal.de/crystal/gpc/de/mail7971.html http://www.gnu-pascal.de/crystal/gpc/de/mail13595.html
Frank