[M3devel] "target specific pragmas"?
Tony Hosking
hosking at cs.purdue.edu
Fri Feb 15 17:20:19 CET 2008
On Feb 15, 2008, at 10:18 AM, Jay wrote:
> I don't know but I could easily see pointer arithmetic banned on
> pointers to garbage collected types.
If you check the C standard you will see that the only *defined*
pointers to array elements are to the elements of the array and the
"element" one index beyond the end of the array. Implementations of
C are technically free to treat other pointer arithmetic however they
like... :-)
> I do NOT assume existing code will get garbage collection without
> source change.
> But then again, what does the Boehm collector do?
>
> And if I write:
>
> a: array of integer;
> for i := 0 to last(a) do (* or last - 1? Modula-3 array bounds not
> what I'm used to...*)
> IO.PutInt(a[i]);
> end
>
> in Modula-3, is the codegen a) really banned from and b) really avoids
> "rewriting" that with pointer arithmetic?
Not banned at all with the current GC. So long as a derived
reference to the array exists the GC will use it to keep the array
alive.
More information about the M3devel
mailing list