char question

Started by
6 comments, last by GameDev.net 18 years ago
Can you rely on the range 0-127 of ascii characters being the same if it is signed or unsigned?
-----------------------------Language: C++API: Win32, DirectXCompiler: VC++ 2003
Advertisement
yes.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Yes, I believe so.
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]

Beginner in Game Development?  Read here. And read here.

 

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.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
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_ProgDes
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]


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