Re:The Lost Art of C Structure Packing (2014)
by kazinator on Friday August 05, 2016 @02:36PM
(#12234774)
Suppose C didn't require order of struct members. How could we support I/O devices? Simply by wrapping them behind functions or macros which take a base address and access a specific register relative to that address using pointer arithmetic and dereferencing. You see this being done anyway!
[ Parent
| on HN ]
Re:The Lost Art of C Structure Packing (2014)
by gaius on Friday August 05, 2016 @04:21PM
(#12235480)
More likely you'd have to drop down into ASM for those bits...
You see in a lot of high performance networking code too, you just get a block of bytes off the wire, cast it to a struct and use it straight away. High risk, high reward :-)