Bit Addressable Architectures

Doug Gwyn gwyn at brl-smoke.ARPA
Tue Mar 29 23:39:42 AEST 1988


In article <504 at sol.warwick.ac.uk> cudcv at cu.warwick.ac.uk (Rob McMahon) writes:
>I wonder how much code out there assumes that ...
>sizeof("constant string"), or sizeof(initialised_char_array)
>is the same as strlen(xx)+1 ?

There's a lot of code like that, no question.  It would continue to
work if sizeof(char) were allowed to be other than 1, on most current
systems, although it might not be portable to other systems or to
future compiler releases.

>Does malloc now take number of bits required, or char's ?

malloc() would be told the number of "bytes" required, where
sizeof(byte)==1.  By "byte" I mean the smallest addressable storage
unit, not necessarily 8 bits in size, nor 1 bit, nor big enough to
represent a character.  (In my proposal this was a "short char".)

Your concerns are legitimate, but so are those of programmers
who have to deal with so-called multi-byte character representations.
Anyway, X3J11 did not buy into the "short char" idea and I doubt they
will be willing to change to it now.



More information about the Comp.lang.c mailing list