<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Modula-3 has bit-mapping.<br>Encoding it in functions that takes offsets and sizes is not hard.<br>Using the language features gives you a choice of either<br> - portable layout that doesn't likely match C<br> - unportable layout that might match C<br> At least unportable in terms of endianness -- again, for better and worse, see how we pick apart floats.<br> It works, but the declarations are duplicated for little endian vs. big endian.<br> Such knowledge does traditionally live in a compiler and its "core" libraries/runtime, but I'd still like to minimize it, maybe eliminate it.<br><br><br>Neither is a ggeat choice I think.<br>The compiler had tried to match target-specific layout/alignment rules.<br>Whether it got them correct, I don't know.<br>I relaxed the code because it was hard to know if it was right or wrong and<br>just didn't seem worth maintaining -- i.e. porting to new systems.<br><br> - Jay<br><br><br><br><div><div id="SkyDrivePlaceholder"></div>> Date: Fri, 24 Aug 2012 10:00:52 -0400<br>> From: hendrik@topoi.pooq.com<br>> To: m3devel@elegosoft.com<br>> Subject: Re: [M3devel] I know, I know...<br>> <br>> On Thu, Aug 23, 2012 at 12:51:15PM -0700, Mika Nystrom wrote:<br>> > <br>> > Well I don't think Jay said that bytes couldn't be unpacked in Modula-3<br>> > (you can just use Word for that).<br>> > <br>> > But I think the point was that a compiler back-end might not necessarily<br>> > obey your packing instructions?<br>> > <br>> > Here's what I think you should do... it would be super useful, both to<br>> > you and other people in the future.  And completely independent of<br>> > compilers.<br>> > <br>> > Write a something-or-other that uses m3tk to read your RECORD type<br>> > spec, plus pragmas <br>> <br>> Pragmas are definitely the wrong choice.  If they are ignored on an <br>> implementation that  doesn't recognise them, this will be the wrong <br>> semantics.<br>> <br>> Coding all the extraction and insertion functions is obscure, picky, and <br>> error-prone.  Bit-mapping is one of the reasons people use systems <br>> languages, and the lack of it is a deficiency in Modula 3.<br>> <br>> Not that I'm advocating rewriting the compiler right away.  It may be a <br>> deficiency we can live with.<br>> <br>> -- hendrik<br></div>                                     </div></body>
</html>