Uses of \\\"short\\\" ?
Niket K. Patwardhan
bilbo.niket at LOCUS.UCLA.EDU
Wed Oct 30 10:43:31 AEST 1985
I guess I was mistaken about the predominance of a specific byte order, and
may even give up on the issue altogether (like I have for floating point!).
But I still feel that C does not give the programmer adequate control over the
size of his storage variables, particularly when he is attempting to write
portable programs; and especially so when those programs have to share data
while running on different machines. A factor of 2 in the size of your program
is no small matter, sometimes it can make the difference between whether the
program is acceptable or not.
As you say, the issue of padding in data structures that will be shared
between different hosts is of even greater concern. Directly tied in is the
ability to control the size of the fields in this data structure. The bit field
notation of C gives you explicit control over the size of fields... if it were
modified it could solve the padding and filling problem too. It would have to
solve at least some of the byte order problem if it were to be effective (think
of bit fields spanning random bytes!) and the simplest implementation would
probably pick some consistent byte order (strict little or big endian).
More information about the Comp.lang.c
mailing list