[M3devel] pointers/arrays?

Tony Hosking hosking at cs.purdue.edu
Mon Dec 27 18:19:24 CET 2010


Have you played around with SUBARRAY?


On Dec 26, 2010, at 11:37 PM, Jay K wrote:

> I'm still wrestling with this. I have found a few options that work and they all have glaring problems.
> 
> 
> VAR macho_header32_t_fields := ARRAY [0..6] OF field_t{
>   field_t{ "magic", 0, 4, enum_table := EnumTable(macho_magic_names)},
> ...
>   field_t{ "flags", 24, 4}};
> 
> 
> 1) I shouldn't have to give the size of the array.
> 2) I shouldn't have to copy the enum table to make it an indexable array.
> 
> 
> Disappointing..
> 
> 
>  - Jay
> 
> 
> From: jay.krell at cornell.edu
> To: m3devel at elegosoft.com
> Date: Mon, 27 Dec 2010 02:11:28 +0000
> Subject: [M3devel] pointers/arrays?
> 
> a: UNTRACED REF T;
> i: INTEGER;
> 
> 
> a[i] ?
> (a + i)^ ?
> 
> 
> Or I'm really stuck with
> LOOPEHOLE(a + i * BYTESIZE(a^), UNTRACED REF T)
> 
> 
> Seems kind of stinky.
> I've got some nice efficient readable safe-enough C and it doesn't seem to translate well easily efficiently to Modula-3.
> 
> 
>  - Jay
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20101227/1d581796/attachment-0002.html>


More information about the M3devel mailing list