On Thu, Aug 23, 2018 at 5:17 PM <ron(a)ronnatalie.com> wrote:
This union was right in the middle of the buf struct:
union {
caddr_t b_addr; /* low order core address */
int *b_words; /* words for clearing */
struct filsys *b_filsys; /* superblocks */
struct dinode *b_dino; /* ilist */
daddr_t *b_daddr; /* indirect block */
} b_un;
There were a number of other places that did the same thing. It's
OFFICIALLY now in undefined behavior by the standard (though of course that
didn't exist in the BSD days) ,
to store in one element of the union and retrieve it via another.
It was still kinda frowned upon in K&R1: "It is the responsibility of the
programmer to keep track of what type is currently stored in a union; the
results are machine dependent if something is stored as one type and
extracted as another."
--
Nevin ":-)" Liber <mailto:nevin@eviloverlord.com> +1-847-691-1404