struct accessing
bob larson
blarson at basil.usc.edu
Tue Jul 4 19:43:46 AEST 1989
In article <1411 at garcon.cso.uiuc.edu> mcdaniel at uicsrd.csrd.uiuc.edu (Tim McDaniel) writes:
>There is a special dispensation, though: "If a pointer to a structure
>is cast to the type of a pointer to its first member, the result
>refers to the first member". [8.3]
There is at least one current (non-ansi) compiler that does not do this
currently, and will be forced to have extra overhead if the first structure
member is a char. Prime 50 series computers arn't byte addressable%, and
the ix mode C compiler avoids the overhead of bit field insert/extract
on char variables not part of an array by treating them as shorts. (char
is unsigned by default, signed char will be rather nasty to implement.)
64v mode C on the Prime puts char variables in the left side of a 16 bit
word, thus using both more time and memory than needed.
% The ix instruction set does have instructions designed for use from C
that do try to fake byte addressing. Unfortunatly, most of the overhead
of the bit field insert/extract is still there.
--
Bob Larson Arpa: blarson at basil.usc.edu
Uucp: {uunet,cit-vax}!usc!basil!blarson
Prime mailing list: info-prime-request%ais1 at ecla.usc.edu
usc!ais1!info-prime-request
More information about the Comp.lang.c
mailing list