<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>Stan Lippmann's excellent book "The C Object Model".. but ok..<br><br>Looks like I missed "not" at important place: Modula-3 programmer does NOT need to know this stuff generally. But Modula-3 implementer does.<br><br> Jay/phone<br><br>> To: jay.krell@cornell.edu<br>> CC: m3devel@elegosoft.com<br>> Subject: Re: [M3devel] Modula-3 object model details? more type improvements in m3cc/parse.c? <br>> Date: Fri, 3 Sep 2010 08:34:48 -0700<br>> From: mika@async.async.caltech.edu<br>> <br>> <br>> Jay can you please not use the term "object model" for what you're<br>> describing here? I think "object model" should be limited to what<br>> is in the Green Book and Cardelli's paper on the Modula-3 type system.<br>> What you're talking about is "object implementation", specific to CM3 and <br>> perhaps a few other compilers, not the Modula-3 programming language.<br>> It is very confusing to see the expression used to cover both concepts,<br>> which, though obviously related, are quite different.<br>> <br>> And no you don't have to know many of these things when programming<br>> in Modula-3. As you say, the book is sometimes deliberately vague.<br>> For some of the points you raise, the programmer should write the program<br>> so it can deal with any possible implementation; for some others it helps<br>> if he knows, but if he doesn't, the compiler may reject some perfectly<br>> legal Modula-3 programs ("implementation restrictions"). Just please<br>> don't mix that up with the language definition...<br>> <br>> Mika<br>> <br>> Jay K writes:<br>> ><br>> >more type improvements in m3cc/parse.c?<br>> ><br>> ><br>> >So=2C the initial goal of fixing SPARC64_SOLARIS<br>> >without breaking anything seems to have worked.<br>> >=A0I have to check all the platforms still.<br>> ><br>> ><br>> >And debugging of records is much much better in gdb.<br>> >=A0 (again=2C needs testing..)<br>> ><br>> ><br>> >Now I'd like to continue:<br>> >=A0enums<br>> >=A0packed<br>> >=A0objects<br>> >=A0function pointer types<br>> >=A0arrays<br>> >=A0open arrays<br>> >=A0<br>> >=A0<br>> >This requires a fairly complete understanding of the "object model".<br>> >Basically what Modula-3 looks like in C.<br>> >=A0 Yes=2C this dovetails into generating C.<br>> ><br>> ><br>> >Stuff like:<br>> >=A0Are enums always 32 bits?<br>> >=A0Or are they chosen among 8=2C 16=2C 32 bits=2C as needed to fit their va=<br>> >lues?<br>> >=A0Or are they always integer sized but we limit them to 2^32 values?<br>> >=A0<br>> >=A0<br>> >What can/does packed do?<br>> >The language spec was deliberately vague.<br>> >It can add arbitrary padding to the end of records?<br>> >It removes any possible padding at end of records?<br>> >It can shrink enums and subranges to other than 8/16/32/64 bits?<br>> >=A0It can grow enums/subranges?<br>> >=A0<br>> >=A0<br>> >=A0What do objects look like?<br>> >=A0I assume they are something like C++ classes with single inheritance.<br>> >=A0A vtable pointer followed by the data.<br>> >=A0<br>> ><br>> >What do arrays look like?<br>> >=A0This was answered recently. Including it here for completeness.<br>> >=A0I should commit what was said.<br>> ><br>> >=A0<br>> >What are the ramifications of the ability to do type switching at runtime?<br>> >Maybe another field in objects?<br>> ><br>> ><br>> >What do exceptions look like?<br>> >=A0Just records?<br>> >=A0<br>> ><br>> >Just read m3front to learn all this?<br>> >And look at generated code?<br>> >I can=2C but I'm lazy.<br>> ><br>> ><br>> >If anyone knows all this stuff off the top of their head=2C<br>> >checking it into doc/notes/objectmodel.txt is roughly<br>> >my preference.<br>> ><br>> ><br>> >I will have to put together a bunch of small samples=2C that<br>> >both RTIO.PrintWhatever their data=2C and step through in gdb<br>> >and see if things match.<br>> ><br>> ><br>> >How much=2C if any of this is subject to change?<br>> >I suspect none of it.<br>> >Sure=2C you are supposed to know it when you write Modula-3.<br>> >But parse.c can/should=2C caveat about making the same decisions as m3front=<br>> >.<br>> ><br>> ><br>> >Thanks=2C<br>> >=A0- Jay =<br> </body>
</html>