[chuck] String variable bug?

Ge Wang gewang at CS.Princeton.EDU
Sat Oct 23 02:23:38 EDT 2004


> this code:
> "bbbbabbbbb" => string foo;
> foo => stdout;
> "bbbbabbbbb" => stdout;
> produces this output:
> bbbbbbbbbb
> bbbbabbbbb

This is a cool bug.  On big endian systems (like mac)
the 8th byte is incremented (instead of 5th).  the 2nd
4-byte word is getting added by one.  We tracked this
down to reference counting in the VM instructions, and
found that strings are not correctly prepared for the
reference counting in the VM.  There is a temporary
fix where strings are now "primitive" like int and float.
You can find this:


chuck - mac os 10.3 exe
chuck.exe - win32 exe
chuck_type.cpp - if you want to recompile, replace chuck_type.cpp with 
this (

All of this will be properly fixed once objects and arrays
are in place - we hope it will be done soon, currently we
are working hard to prepare the audicle prototype for ICMC
next week.

Please let us know if the fix is good.


More information about the chuck mailing list