[M3devel] m3gap.... it's an alignment issue

Jay K jay.krell at cornell.edu
Sat Oct 9 23:53:18 CEST 2010


> Idealized is you grow everything to LONGINT or INTEGER and sort by size,
> and copy back/forth with C. There will be no padding, guaranteed.

I sort of made up these rules btw, and then sort alphabetically.
And for good measure, during initialization, you can
pass a value or var/pointer of one of these structs to/from
C/Modula-3 and assert on the other side that it looks as expected.
 
 
For example:
http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-sys/m3tests/src/TestC.c
http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-sys/m3tests/src/Test.i3
  "CheckFloatsAndTypes"
 
I couldn't find where I call it.
I would be reasonble imho to put in m3core.
 Though the float stuff should be better thought out to have
  a complete but no extra test.
Maybe even passed from main to RTLinker.InitRuntime.
 
This is also done in:
http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/m3core/src/time/POSIX/DatePosixC.c
  function TypeCheck
 
 
To make sure the C and Modula-3 line up.
Note this isn't with "underlying C", but with our own C.
I moved things up a layer to avoid extra copying of struct tm,
and so I could #ifdef the 2 almost identical implementations into one.
 
 
 - Jay 		 	   		  


More information about the M3devel mailing list