<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'>1) Most likely, whatever you want, you can get with Modula-3.<br>You can at least attain the compactness you want.<br>How you match up with some specified protocol, independently<br>implementable e.g. with C and shifting/masking, less certain.<br><br><br>2) If this is for some network/persistant I/O, the result will<br>not be portable. At least due to endianness. Possibly due to alignment.<br><br><br>3) I claim that interop with C remains a strong feature of Modula-3,<br>but not necessarily regarding bitfields. There is some attempt at such<br>interop, but I'd just as soon ignore it. I'd even give an error<br>if types with bitfields are used with <* external *> functions.<br><br><br>For my libc interop, I'm very conservative -- records contain just<br>longint and integer, sorted by size -- there is never any padding,<br>except maybe at the end.<br>I looked a bit through "windows.i3" and "xlib.i3" and decided<br>they seem pretty save too.<br><br><br><br>3) I am faced with generating target-independent C.<br>This is the worry/doubt I inject/tangent into your line of questioning.<br>  You ask about one thing, I bring up something else (kind of like Daniel..)<br>m3front checks endian, making it almost impossible.<br>I fear there isn't a good answer here.<br>I kind of would just like to a) remove the check b) adjust<br>{libm3, m3core}/float accordingly.<br>Alternatively, change m3front/m3cg some.<br>Have the result say:<br><br><br>#ifdef LITTLE_ENDIAN<br>something<br>#else<br>something else<br>#endif<br><br><br>Perhaps the endian check can be removed if the target platform is "C"?<br><br><br>Relevant aside:<br>"By default", in C#, layout is undefined.<br>It could sort the fields by size/name, I think, and be valid.<br>  Or put stuff near each other based on runtime profiling.<br>  Is Modula-3 this abstracted too??<br>But there are at least two ways to control the layout.<br>You can assert that it must be "sequential".<br>You can give actual offsets.<br>I don't think C# even has bitfields though.<br><br><br> - Jay<br><br><br><br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Subject: Re: [M3devel] Modula-3 bitfields<br>From: dragisha@m3w.org<br>Date: Sat, 25 Aug 2012 08:31:16 +0200<br>CC: jay.krell@cornell.edu; m3devel@elegosoft.com<br>To: mika@async.caltech.edu<br><br>I see no problem with this. <div><br></div><div>As I have illustrated, we are already apart from "implied mapping to C". Also - proposed pragma is local behavior. Not active unless you need it, but when you need it you will be really grateful for it :).<div><br><div>
<span class="ecxApple-style-span" style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;font-size:medium"><span class="ecxApple-style-span" style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word"><div>--</div><div>Divided by a common language</div><div><br></div><div>Dragiša Durić</div><div><a href="mailto:dragisha@m3w.org">dragisha@m3w.org</a></div><div><br></div></div></span><br class="ecxApple-interchange-newline"></span><br class="ecxApple-interchange-newline">
</div>
<br><div><div>On Aug 25, 2012, at 7:35 AM, Mika Nystrom wrote:</div><br class="ecxApple-interchange-newline"><blockquote><span class="ecxApple-style-span" style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;font-size:medium">Yeah I think Modula-3 historically tries to stay as close as possible to<br>an implied mapping to C.  It's definitely *not* big-endian on a little-endian<br>machine.<br></span></blockquote></div><br></div></div></div>                                        </div></body>
</html>