[M3devel] unable to put M3CG.TypeUID into a record

Jay K jay.krell at cornell.edu
Mon Oct 29 07:26:22 CET 2012


Thank you.

> Date: Sun, 28 Oct 2012 11:00:26 -0500
> From: rodney_bates at lcwb.coop
> To: m3devel at elegosoft.com
> Subject: Re: [M3devel] unable to put M3CG.TypeUID into a record
> 
> I do like this idea.  It took me a while to catch on to the rule that
> a field of packed type not only must occupy exactly the stated bit
> count, but also must not have any compiler-added padding ahead of it.
> While this is just what is needed for programmer-control of record
> layout, it seems that almost everyone keeps missing it and getting
> tripped up by it.
> 
> After having trouble with record layouts that became illegal after
> changes in non-packed fields, I have made it a convention not to
> put BITS--FOR in a type declaration, but only use it as an anonymous
> type expression for a record field or array element.  The named type in
> the type declaration will likely be used in several contexts, with differing
> packing contexts.  The packing really needs to be independently thought
> about for each record field and array element.
> 
> On 10/26/2012 04:31 AM, Jay K wrote:
> > This is one reasonable way to fix it:
> >
> > Index: M3CG.i3
> > ===================================================================
> > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG.i3,v
> > retrieving revision 1.10
> > diff -u -r1.10 M3CG.i3
> > --- M3CG.i36 Sep 2012 02:03:06 -00001.10
> > +++ M3CG.i326 Oct 2012 09:30:31 -0000
> > @@ -98,9 +98,9 @@
> >     Always : Frequency = LAST (Frequency);
> >   TYPE
> > -  Int32 = [-16_7fffffff-1 .. 16_7fffffff];
> > -  TypeUID = BITS 32 FOR Int32;
> > +  TypeUID = [-16_7fffffff-1 .. 16_7fffffff];
> >     (* a 32-bit unique id (fingerprint) for each type.  *)
> > +  assert_TypeUID_fits_in_32bits = BITS 32 FOR TypeUID;
> >   TYPE
> >     Label = INTEGER;
> > Index: M3CG_MultiPass.i3
> >
> >
> >   - Jay
> >
> >
> > ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>  --
> > From: jay.krell at cornell.edu
> > To: m3devel at elegosoft.com
> > Date: Fri, 26 Oct 2012 09:27:36 +0000
> > Subject: [M3devel] unable to put M3CG.TypeUID into a record
> >
> > I still really don't like how M3CG.TypeUID is defined.
> >
> > Asserting that a type fits in 32bits
> > should not preclude putting it into a RECORD.
> >
> > Currently you cannot put M3CG.TypeUID into a record.
> >
> > The following does not work:
> >
> > RECORD whatever = typeid: M3CG.TypeUID; END;
> >
> > That seems really absurd to me.
> >
> >   - Jay
> >
> >
> >  > Date: Fri, 26 Oct 2012 11:22:55 +0000
> >  > To: m3commit at elegosoft.com
> >  > From: jkrell at elego.de
> >  > Subject: [M3commit] CVS Update: cm3
> >  >
> >  > CVSROOT: /usr/cvs
> >  > Changes by: jkrell at birch. 12/10/26 11:22:55
> >  >
> >  > Modified files:
> >  > cm3/m3-sys/m3back/src/: M3C.m3
> >  >
> >  > Log message:
> >  > continue to hack around bogus packing of M3CG.TypeUID
> >  >
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20121029/0289ee3b/attachment-0002.html>


More information about the M3devel mailing list