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

Hi Roy! :-)

 RJT> Not necessarily ASCII,  but whatever "char" is that's
native to the 
 RJT> platform you're running on.  If it was EBCDIC,  then they're 8-bit 
 RJT> characters.
I don't think there is any C compiler where a char has more or less than 8 bits.

 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".
 RJT> I just wish that some folks would _do_ that when they write stuff,  
 RJT> instead of it being the default for whatever the case may be.  Like 
 RJT> using a "long" to represent the quantity of free space on a hard 
 RJT> drive.  That number is _never_ going to go negative,  so
"unsigned" 
 RJT> should be in there too,  but enough programmers left it out 
 RJT> (laziness? some other reason?) that >2G drives break an awful lot of 
 RJT> software.  Or did,  anyhow,  under dos for one example.
That's one example where it is really critical. Most of the time it doesn't
really matter - it's not that often that you need the full 32 bits of an
int. For file sizes or free space on partition I'd use a 64 bit variable
anyway,  even 4 GB is two small for today's systems.

Note that the size of a long changes depending on the target CPU (at least
in gcc) - for 32 bit archs, a long is 32 bits (and an int as well). For 64
bit archs, long is 64 bits and int is 32 bits.

Ciao
Pascal

--- Msged/LNX 6.1.1
* Origin: let fun a b c d = b (c,d) in a op < 17 end 23 (1:153/401.2)
SEEN-BY: 633/267 270
@PATH: 153/401 307 140/1 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™.