3 ms·
> Structs are fully mapped if all their fields are fully mapped. I recall some SPARC arch (uSparc?) circa 199x that would place chars and shorts in a struct as
by minipci1321 10y ago
> Structs are fully mapped if all their fields are fully mapped.
I recall some SPARC arch (uSparc?) circa 199x that would place chars and shorts in a struct as if it were an int (i.e, aligned on boundary of 4). Then, when loading this field from the structure, it would load a full word, then shift it 16 or 24 bits left then right, to propagate sign or 0 and squeeze out undefined bits.
Interestingly enough, for programming it we used Sun Workbench which had some rudimentary equivalent of valgrind. So if in my code I would initialize the struct by initializing every attribute, then copy the entire structure using memcpy, the tool would complain about reads from uninitialised -- exactly because of the paddings of shorter types.