[M3devel] TextLiteral.MaxBytes again

Tony Hosking hosking at cs.purdue.edu
Tue Sep 3 14:13:33 CEST 2013


Who would ever create a text literal that exceeds MaxBytes?

Sent from my iPad

On Sep 3, 2013, at 2:02 AM, Jay K <jay.krell at cornell.edu> wrote:

> ok, another question:
> 
> 
> CONST
>  (* DIV BITSIZE should not be here! *)
>  (* MaxBytes = LAST (INTEGER) DIV BITSIZE (Byte) - 7 - 8 * ORD(BITSIZE(INTEGER) = 64); *)
>  MaxBytes = 16_7FFFFFFF DIV BITSIZE (Byte) - 7 - 8 * ORD(BITSIZE(INTEGER) = 64);
> 
> TYPE
>   T = RTHooks.TextLiteral;
> REVEAL
>   T = TEXT BRANDED "TextLiteral.T" OBJECT
>     cnt : INTEGER;
>     buf : ARRAY [0..MaxBytes - 1] OF Byte;
>   OVERRIDES ...
> 
> 
> T is a reference type.
> Is there a way to state this with no limit?
> 
> 
> Isn't it already unsafe?
> You know -- the array is usually smaller and the compiler is only going to check against this large size.
> 
> 
>  - Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20130903/25a9c7b9/attachment-0002.html>


More information about the M3devel mailing list