char question
Can you rely on the range 0-127 of ascii characters being the same if it is signed or unsigned?
Yes. Only Extended ASCII characters [128:255] are subject to sign issues. (is that valid english? o_O)
Quote:Original post by Konfusius
Yes. Only Extended ASCII characters [128:255] are subject to sign issues. (is that valid english? o_O)
yes it is. congratulations.
you'll find that most americans unlike their british counterparts don't worry about valid english. [grin]
Isn't there supposedly some horrible system somewhere with 7 bit characters, meaning [64:127] could be negative?
Not that I care, I regularly make the probably false assumption that char is at least 8 bits.
Not that I care, I regularly make the probably false assumption that char is at least 8 bits.
Quote:Original post by smart_idiot
Isn't there supposedly some horrible system somewhere with 7 bit characters?
Not that I care, I regularly make the probably false assumption that char is at least 8 bits.
You can store the full ascii set in 7 bits (0-127), so I suppose that you could have to deal with -ve ascii chars, but very few people ever use platforms with non-8 bit chars (for game development).
Quote:Original post by Alpha_ProgDesQuote:Original post by Konfusius
Yes. Only Extended ASCII characters [128:255] are subject to sign issues. (is that valid english? o_O)
yes it is. congratulations.
you'll find that most americans unlike their british counterparts don't worry about valid english. [grin]
Bah, humbug.
Quote:Original post by smart_idiot
Isn't there supposedly some horrible system somewhere with 7 bit characters, meaning [64:127] could be negative?
Not that I care, I regularly make the probably false assumption that char is at least 8 bits.
CHAR_BIT is required to be at least 8 bits by the ISO C standard. The ISO C++ standard defines CHAR_BIT in terms of the ISO C standard. Thus, char is at least 8 bits. More directly, CHAR_MAX is required to be at least 127. (CHAR_MAX is equivalent to either SCHAR_MAX (at least 127) or UCHAR_MAX (at least 255), depending on whether char is treated as signed or unsigned.)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement