Re: Running safe.e ???
- Posted by Robert Craig <rds at RapidEuphoria.com> Sep 20, 2003
- 435 views
Bernie Ryan wrote: > Rob: Why does this fail ? > ... > > =================================== > include safe.e > > atom a a = allocate_string("") > ? a > ? peek(a) > ... You've found a bug in safe.e Thanks for pointing this out. In the version of allocate_string() in 2.3 and 2.4, the code was optimized slightly (by Aku). The result is that when you call allocate_string("") there's a call to poke() with an empty (length-0) sequence. This is a no-op. i.e. no bytes are written to memory. However, the special version of poke used by safe.e does not correctly error-check pokes of length-0 sequences, and this triggers a false-alarm error message. I'll fix safe.e for the next release. Meanwhile maybe you can avoid allocate_string(""), at least for debugging with safe.e. Any non-empty string will work ok. > Also will location a always contain a terminating zero ? Yes, a 0 terminator will always be written in memory after the string, even if the string is empty. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com