ANSI chars aren't bytes?

Ray Butterworth rbutterworth at watmath.UUCP
Fri Jan 16 01:39:44 AEST 1987


 >  From: gwyn at brl-smoke.ARPA (Doug Gwyn )
 >  Subject: Re: RMS comments to X3J11 (LONG)
 >  Date: 8 Jan 87 15:56:56 GMT
 >  >      short in, out;
 >  >      {
 >  >          char *inptr, *outptr;
 >  >          inptr = (char *) ∈
 >  >          outptr = (char *) &out;
 >  >          int i;
 >  >          for (i = 0; i < sizeof (short); i++)
 >  >              outptr[i] = inptr[i];
 >  >      }
 >  >  is defined and equivalent to
 >  >      short out, in;
 >  >      out = in;
 >  No, this can't be guaranteed.  For example, there may be bits
 >  in the short that are not covered by its chars.

Is this really true?  That means that functions such as memcopy(),
memcmp(), fwrite(), and fread() can not be implemented in C.  They
must be written in assembler or Pascal or Cobol or some other
language.

If this really is true, the standard should state so very explictly
since I'm sure that many people aren't aware of this fact or of its
implications.



More information about the Comp.lang.c mailing list