Structure pointer question

Karl Heuer karl at haddock.ISC.COM
Mon Jun 20 05:16:50 AEST 1988


In article <5925 at aw.sei.cmu.edu> firth at bd.sei.cmu.edu.UUCP (Robert Firth) writes:
>Surely a pointer to a struct whose only component is of type X will use the
>same representation as a pointer to a plain X.

Nope.  The fact that incomplete types are allowed in some circumstances (e.g.
the existence of mutually recursive types) implies that all struct pointers
have to smell the same.  Thus, on word-addressible machines, struct{char} is
word-aligned and padded.  (Or else all structs use byte-pointers, but I don't
believe I've heard of such implementations.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list