(snip, I wrote)
I'm not sure what you mean by "the C assumptions". As you know,
C very specifically does not assume that 8-bit bytes (though it
does assume *at least* 8-bit bytes).
Well, someone previously mentioned that C allows one to consider
a double as bytes. And yes you can check CHAR_BIT before doing
that, but most people don't.
At least some compression algorithms are defined in terms of 8-bit
bytes (see RFCs 1951 and 1952, for example). That limitation isn't
imposed by C. No doubt you could define a compression algorithm
that operates in bit sequences, but then you'd need metadata to
indicate how many bits of the last byte are part of the data.
Well, say you are on a 36 bit system and CHAR_BIT is 9.
Assuming you check it, you can write a compression algorithm that
will read and write sequences of 9 bit bytes. The C library, then,
has to read 36 bit words, pass them in as 9 bit bytes, take the 9
bit bytes that come out, and reassemble them as 36 bit words before
writing to disk.
LZW (compress or gzip) normally writes out groups of bits between 9
and 16 bits long. (Lots of shift, and, and or operations.)
It probably isn't hard to use CHAR_BIT to change that to compress
an input of 9 bit bytes.
It's not clear (to me) how you'd even copy an 8-bit file to 36-bit
system, let alone compress or decompress it, though I presume there
are ways to do it.
That is where it gets interesting. I think Kermit knows how to do it.
DEC systems store ASCII text as five 7 bit characters per word, with
one bit left over. (Some editors would use that bit to indicate
that a line had a line number in it.) In the case of ASCII text
files, you have to consider that when transferring to/from 8 bit
systems.
A compressed stream of 9 bit bytes won't work at all when it gets
to an 8 bit system. The CHAR_BIT minimum of 8 makes no allowance
for a system where text files are a sequence of 7 bit bytes in 36
bit words.
While in theory C allows for other than 8 bit bytes, it is too
easy for programmers to assume it, and that, in turn, may have helped
the popularity of 8 bit systems.
-- glen