I decided to get all the arrays to use the same interface as far as possible, so I can "typeclass" them.. Imagine my annoyance when this program:
var aa = 0,0,0,0,0,0,0,0,0,0; var va = varray[int] (10,0); var da = darray[int] (10ul,0); var sa = sarray[int] (0); var i:int; forall i in 0 upto 9 do set(&aa,i,i); println$ i,get(aa,i); set(va,i,i); println$ i,get(va,i); set(da,i.ulong,i); println$ i,get(da,i); set(sa,i.ulong,i); println$ i,get(sa,i.ulong); done gave a bus error (on darray case). [Can you see why?] So I thought, oh no, not a horrible C++ bug in the gc again ... then I remembered, no .. Felix is actually pretty reliable these days so .. darray uses varray so .. proc _unsafe_set[t]: varray[t] * !ints * t = "$1[$2]=$3;"; proc set[t,ii in ints] (a:varray[t], i:ii,v:t) { assert 0ul <= i.ulong and i.ulong < len a; _unsafe_set(a,i.ulong,v); } Assertion Failure Felix location: build/release/lib/std/varray.flx 79[5]-79[46] C++ location : test/regress/rt/array-02.cpp 238 Well! How can this be?? So .. var aa = 0,0,0,0,0,0,0,0,0,0; var va = varray[int] (10,0); var da = darray[int] (10ul,0); var sa = sarray[int] (0); len aa= 10 len va= 2 len da= 10 Wha?? Length 2?? Can you see why? [BTW: Felix actually has a "range_check" macro and a special term, but it is hard to use at the moment because the macro, like assert, requires both Felix and C++ source references. The advantage is it tells you the wrong value and the range it is supposed to be in. I need to fix that] -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language