Why no arithmetic on void *

Doug Gwyn gwyn at smoke.brl.mil
Sat Jan 26 04:51:22 AEST 1991


In article <279D93D3.5EE7 at tct.uucp> chip at tct.uucp (Chip Salzenberg) writes:
>"sizeof(char)==1" is hard-coded into innumerable calls to fread() and
>other library functions.

I had to figure out the ramifications when I wrote my "short char" proposal.
Actually there are enough problems with use of fread() etc. that I don't
think much more work would be needed to accommodate sizeof(char)>1 than
is already necessary to properly include <stdio.h>, use size_t, etc.  Also
note that in any implementation where it was decided to make sizeof(char)
remain 1, the existing usage would not be a problem.  For quite some time
I had been writing code that did not assume sizeof(char)==1, just in case.
Now that the standard requires sizeof(char)==1, I don't think there is any
real chance that it will ever change, so one can safely assume that
constraint.



More information about the Comp.std.c mailing list