[M3devel] unused warning isn't transitive
Jay K
jay.krell at cornell.edu
Thu Jul 30 09:26:42 CEST 2009
1) I was guessing inappropriately when I added BITS 32. I'll remove it.
2) I understand the need to have exactly sized types, certainly. I don't understand Modula-3's features here.
- Jay
----------------------------------------
> Date: Wed, 29 Jul 2009 20:48:36 -0500
> From: rodney.m.bates at cox.net
> To: m3devel at elegosoft.com
> Subject: Re: [M3devel] unused warning isn't transitive
>
> There is more wrong with this code than unused warnings.
> From 2.2.5 Packed types: "variables of type T that occur in
> records, objects, or arrays will occupy exactly n bits and be
> packed adjacent to the preceding field or element".
> (here, type T is BITS n FOR Base).
>
> The packed type has no effect when variables of T are not
> so enclosed. And the Int32Rec is nowhere enclosed in a
> record, object, or array. Perhaps the BITS 32 FOR should be
> moved inside the record and applied to the type of field v?
>
>
> Jay K wrote:
>> TYPE Int32Rec = BITS 32 FOR RECORD v : Swap.Int32 END;
>> (* We need v to be inside a record. Otherwise, the language would allow
>> a compiler to actually allocate more than the BITS 32 for a value of
>> type Swap.Int32.
>> *)
>> VAR Int32RecVar : Int32Rec;
>> VAR CheckInt32 : [ 0 .. 0 ] := ADR(Int32RecVar) - ADR(Int32RecVar.v);
>>
>>
>> Compiler complains that CheckInt32 isn't used.
>> It should also perhaps mention Int32RecVar therefore.
>>
>>
>> - Jay
>>
>
More information about the M3devel
mailing list