<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif">Not if you do it well. Plan 9 did it and it was easy.</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">The notion that the struct layout must correspond to the hardware device's layout is about as non-portable as thinking can get.</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">-rob</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Mar 5, 2025 at 8:27 AM Greg A. Woods <<a href="mailto:woods@robohack.ca">woods@robohack.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">At Tue, 04 Mar 2025 06:37:56 +0000, Lars Brinkhoff <<a href="mailto:lars@nocrew.org" target="_blank">lars@nocrew.org</a>> wrote:<br>
Subject: [TUHS] Re: Any UNIX With No C In Userland?<br>
><br>
> I NEVER EVER use C structs or bit fields for this.  I get the raw octets<br>
> (or whatever the byte size is), and shift and mask accordingly to get<br>
> the data fields.<br>
<br>
Marshalling data in or out byte by byte is of course safe and is<br>
definitely the most portable way, and one can of course still read or<br>
write "record"-length amounts of bytes at one time (or multiples of<br>
records).  It just can be a little more tedious.<br>
<br>
--<br>
                                        Greg A. Woods <<a href="mailto:gwoods@acm.org" target="_blank">gwoods@acm.org</a>><br>
<br>
Kelowna, BC     +1 250 762-7675           RoboHack <<a href="mailto:woods@robohack.ca" target="_blank">woods@robohack.ca</a>><br>
Planix, Inc. <<a href="mailto:woods@planix.com" target="_blank">woods@planix.com</a>>     Avoncote Farms <<a href="mailto:woods@avoncote.ca" target="_blank">woods@avoncote.ca</a>><br>
</blockquote></div></div>