C standards and committees (was Re: strangest systems I've sent email from)
Mouse
mouse at Rodents-Montreal.ORG
Sun May 22 07:40:13 CDT 2016
>>> First off, the C standard mandates that the order of fields in a
>>> struct cannot be reordered,
>> Yes. (I think this is a Bad Thing, but I can see why they did it.)
> Given that C is a systems implementation language, how would you
> define HW related data structures where the order of the fields is
> critical (ie HW defines them).
I can see three answers.
1) Don't use structs for that. Look at NetBSD's bus-space abstraction
for one possible way.
2) Make any reordering implementation-defined, so that code for
specific implementations can know how the implementation does it.
3) Make reordering optional. Which way the default should go is
arguable; since my guess is that most structs are not
hardware-interface structs, the default should be reordering, with
some keyword specifying no reordering.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
More information about the cctalk
mailing list