How does the "classic" windows message loop play into this? It's structure
appears to be that of a "traditional" Forth program: BEGIN WHILE REPEAT
which repeats until the program quits.
Mike
-----Original Message-----
From: sftalk-admin_at_forth.com [mailto:sftalk-admin_at_forth.com]On Behalf Of
Rick VanNorman
>> is doomed to stack over or underflow ( I suspect over).
>
>Right again - almost. It would overflow if this was a traditional FORTH
>program. What makes things tricky in Windows is (jump in and clarify Rick)
that
>for every windows message, a stack frame is created and then destroyed
after the
>message is processed. Any minor Forth stack problems disappear. When
testing,
>one has to verify stack correctness for each message since a stack
imbalance is
>not cumulative. For example, try adding
>100 0 DO I LOOP 0 ( res ) to the end of a message. The stack frame
mechanism
>seems much less tolerant to underflows, only a couple (Rick?) of words.
This is exactly correct. In a callback, the stack overflow tolerance is
very large, on the order of 2k cells. Underflow is limited to about 4 cells.
On each callback entry, a new, empty stack frame is created; on exit the
entire stack frame is discarded and only the top value on the stack is
returned.
Clear as mud?
Rick VanNorman
_______________________________________________
Sftalk mailing list Sftalk_at_forth.com
Visit Sftalk on the web at http://www.forthinc.com/mailman/listinfo/sftalk
Received on Fri Nov 10 2000 - 09:45:08 PST
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.