The importance of alignment on a VAX
Eugene D. Brooks III
brooks at lll-crg.ARPA
Wed Mar 27 11:18:34 AEST 1985
> >the hardware will support it easily. It would be nice to read structures
> >from other machines (like PDP-11's) sometime.
> So C needs something like the Pascal keyword `packed'. (hee hee)
A packed structure type would only give portability between a few machines.
Although I would never want a machine with a 36 bit word they do exist and
some of them have C compilers.
The portability problem is best handled with a subroutine or macro to read
the structure. Using a 'packed' structure introduces a speed penalty when
the structure is used elsewhere and a hole host of other troubles just for
the sake of giving limited I/O portability. I can't see any sense in this.
This is against the philosophy of the language. The language has no I/O at all.
Lets keep the I/O in routines where it belongs. If you want to read a structure
from a pdp11 write a routine or a macro.
It appears to me that packed structures are even jumping the gun. Does the C
language even define the order in which the elements of a structure are placed
in memory? The chapter on structures in K&R only states that the structure is a
grouping of data items and I failed to find any statements about ordering of the
elements. Am I mistaken about this?
More information about the Comp.lang.c
mailing list