I get garbage after inserting strings in a list Doing the same with List:Float it works

Message posted by grings on2005/11/11 18:34:20

I get garbage after inserting strings in a list Doing the same with List:Float it works------8<---------------------------------------------------module "/pliant/language/compiler.pli" #For the List typeconstant FloatQueue List:Floatconstant StrQueue List:Str

method q enqueue v arg_rw FloatQueue q; arg Float v q += v

method q dequeue -> v arg_rw FloatQueue q; arg Float v

var Pointer:Float pv :> q first q -= pv v:= pv

method q enqueue v arg_rw StrQueue q; arg Str v q += v

method q dequeue -> v arg_rw StrQueue q; arg Str v

var Pointer:Str pv :> q first q -= pv v:= pv

#tests

gvar FloatQueue fqgvar Float f:=0gvar Int i

for i 0 10 fq enqueue f+i

for i 0 10 console (fq dequeue) eol

gvar StrQueue sqgvar Str s:="s"

for i 0 10 console s+(string:i) eol sq enqueue (s+(string:i))

for i 0 10 console (sq dequeue) eol

Message posted by hubert.tonneau on2005/11/11 18:43:04

The following is buggy: q -= pv v := pvbasically, you are accessing a just freed object !