j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Hi
I have noticed an abnormal behavior in the string handling. Below is the snapshot of the same.
0 > ok 0 > " hi" " hello" " bye" " welcome" ok 8 > .s <8> 4005810c 2 4005800c 5 4005810c 3 4005800c 7 ok 8 >
Above the strings " hi" and " bye" are stored at the same address(0x4005810c) and also " hello" and " welcome" are stored at the same address(0x4005800c).This means that the first two strings " hi" and " hello" are overwritten and therefore lost. Strings defined using ' s" ' also show the same behavior.
Is this an intended behavior? Please verify the same.
Shon
The information contained in this e-mail message and in any annexure is confidential to the recipient and may contain privileged information. If you are not the intended recipient, please notify the sender and delete the message along with any annexure. You should not disclose, copy or otherwise use the information contained in the message or any annexure. Any views expressed in this e-mail are those of the individual sender except where the sender specifically states them to be the views of SoCrates Software India Pvt Ltd., Bangalore.
* shon@soc-soft.com shon@soc-soft.com [050512 09:10]:
0 > ok 0 > " hi" " hello" " bye" " welcome" ok 8 > .s <8> 4005810c 2 4005800c 5 4005810c 3 4005800c 7 ok 8 >
Above the strings " hi" and " bye" are stored at the same address(0x4005810c) and also " hello" and " welcome" are stored at the same address(0x4005800c).This means that the first two strings " hi" and " hello" are overwritten and therefore lost. Strings defined using ' s" ' also show the same behavior.
The words reading strings from the interpreter into memory are using a "pockets" implementation with two alternating string buffers. This means if you want to put more than two strings on the stack without touching them in between you need to create a copy of those strings. Think of it as a temporary string buffer.
Is this an intended behavior? Please verify the same.Q
It is indeed intended, since many forth engines do this the same way. If it is not sufficient, you can raise the number of pockets in forth/bootstrap/bootstrap.fs. Go look for: \ pockets implementation for 7.3.4.1
If you have some reasonable sample code that needs more pockets rather than becoming overly complex, we can raise the number of pockets in the official tree.
Regards, Stefan