[M3devel] TextLiteral.MaxBytes -- use LONGINT or Target.Int more?

Rodney M. Bates rodney_bates at lcwb.coop
Fri Sep 6 22:01:36 CEST 2013



On 09/05/2013 07:06 PM, Jay K wrote:
>  > > How do I declare an unbouned-ly sized array?
>  >
>  > You use an open array. Then the compiler arranges to store its bound at runtime,
>  > using that instead of a static constant when generating bounds checks.
>
> Sorry, I meant a pointer that I can index arbitrarily far.
> I think this is just UNTRACED REF T .

Ah, do you mean you want to disable the bounds check?  Using the ARRAY types of Modula-3,
I don't believe you can.  I think I recall some kind of compiler option, not so easy to
find, that will do this, but I think unselectively for all subscripted array references
in, perhaps an entire source file.  Based on painful experiences of my own and others,
going a long way back, I never do this.

For single-character-at-a-time, you can avoid array types altogether something like:

Element I of Array A, of elements of type ET:

LOOPHOLE(ADR(A[0]) + (I-FIRST(A))*ADRSIZE(ET), UNTRACED REF ET)^

But watch out for sub-adr-sized or non-integral-adr-sized elements!

>
>   > . In at least some targets, these are also stored in readonly segments as well.
>
> Surely this is all targets these days/years/decades.
>
>   - Jay




More information about the M3devel mailing list