[TUHS] Any UNIX With No C In Userland?

Rob Pike robpike at gmail.com
Wed Mar 5 09:54:01 AEST 2025


Not if you do it well. Plan 9 did it and it was easy.

The notion that the struct layout must correspond to the hardware device's
layout is about as non-portable as thinking can get.

-rob


On Wed, Mar 5, 2025 at 8:27 AM Greg A. Woods <woods at robohack.ca> wrote:

> At Tue, 04 Mar 2025 06:37:56 +0000, Lars Brinkhoff <lars at nocrew.org>
> wrote:
> Subject: [TUHS] Re: Any UNIX With No C In Userland?
> >
> > I NEVER EVER use C structs or bit fields for this.  I get the raw octets
> > (or whatever the byte size is), and shift and mask accordingly to get
> > the data fields.
>
> Marshalling data in or out byte by byte is of course safe and is
> definitely the most portable way, and one can of course still read or
> write "record"-length amounts of bytes at one time (or multiples of
> records).  It just can be a little more tedious.
>
> --
>                                         Greg A. Woods <gwoods at acm.org>
>
> Kelowna, BC     +1 250 762-7675           RoboHack <woods at robohack.ca>
> Planix, Inc. <woods at planix.com>     Avoncote Farms <woods at avoncote.ca>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20250305/0f4a7c3d/attachment.htm>


More information about the TUHS mailing list