home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Bug_Fixes / Net.v7bugs / 0089 < prev    next >
Encoding:
Text File  |  1982-03-11  |  670 b   |  15 lines

  1. Autzoo.1481
  2. net.bugs.v7
  3. utcsrgv!utzoo!henry
  4. Thu Mar 11 17:29:19 1982
  5. (unsigned)char
  6. Casting a char value to unsigned in the V7 compiler does a very nice
  7. job of something that is awkward to get otherwise:  zero-extending
  8. rather than sign-extending a char.  The trouble is, that's a bug:  be
  9. warned.  The official behavior of casts, according to DMR, is that
  10. they act like assignment to a temporary variable of that type.  Which
  11. means that casting char to unsigned goes via int the same way a normal
  12. assignment does, and the sign gets extended.  This is fixed in DMR's
  13. more recent C compilers (when I asked him, he wasn't sure whether the
  14. 3.0 compiler was recent enough).
  15.