Article View: net.bugs.v7
Article #47(unsigned)char
From: utzoohenry
Date: Thu, 11 Mar 1982 17:29
Date: Thu, 11 Mar 1982 17:29
9 lines
757 bytes
757 bytes
Casting a char value to unsigned in the V7 compiler does a very nice job of something that is awkward to get otherwise: zero-extending rather than sign-extending a char. The trouble is, that's a bug: be warned. The official behavior of casts, according to DMR, is that they act like assignment to a temporary variable of that type. Which means that casting char to unsigned goes via int the same way a normal assignment does, and the sign gets extended. This is fixed in DMR's more recent C compilers (when I asked him, he wasn't sure whether the 3.0 compiler was recent enough).
Technical Details
Message-ID:
<anews.Autzoo.1481>Path:
arc1-ca.pugleaf.net!utzoo!henryShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!henry From: utzoo!henry Newsgroups: net.bugs.v7 Subject: (unsigned)char Date: Thu, 11 Mar 1982 17:29:19 +0000 Message-ID: <anews.Autzoo.1481>