TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Pascal Schmidt
from: Roy J. Tellason
date: 2004-01-19 04:06:52
subject: [C] (Thanks)An interesting question

Pascal Schmidt wrote in a message to Jasen Betts:

 PS> Hi Jasen! :-)

 JB> signed is the default for long int and short, why should char be the
 JB> exception?

 PS> Well, it's mostly used for storing ASCII characters, and having
 PS> negative characters is somewhat odd. ;)

Not necessarily ASCII,  but whatever "char" is that's native to
the platform you're running on.  If it was EBCDIC,  then they're 8-bit
characters.

 PS> Though even that would not be a real problem for pure ASCII 
 PS> (0-127), so most of the time it doesn't even make a difference in
 PS> practice whether char is signed or unsigned.

 PS> Anyway, if your code depends on it being one way or the other, make
 PS> it explicit by using "signed char" or "unsigned char".

I just wish that some folks would _do_ that when they write stuff,  instead
of it being the default for whatever the case may be.  Like using a
"long" to represent the quantity of free space on a hard drive. 
That number is _never_ going to go negative,  so "unsigned"
should be in there too,  but enough programmers left it out (laziness? some
other reason?) that >2G drives break an awful lot of software.  Or did, 
anyhow,  under dos for one example.

My otherwise favorite file manager for dos and OS/2,  InspectA,  has this
problem.  Not under dos,  but definitely under OS/2.  When I had an OS/2
setup going I'd had one big (5G+) HPFS partition,  part of the whole point
I was using OS/2 to begin with,  and all of a sudden that "free
space" number went down to zero and then went negative!  So it
wouldn't let me move/copy files to that drive,  and I had to use other
means,  until such point as it reached the next "turning point"
and I could use the software again.

--- 
* Origin: TANSTAAFL BBS 717-838-8539 (1:270/615)
SEEN-BY: 633/267 270
@PATH: 270/615 150/220 3613/1275 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.