TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: andrew clarke
from: David Nugent
date: 1996-10-09 04:42:12
subject: Auto string-length determination

> ac>> sizeof(char) == 1 [byte] on all platforms.

 > > Depends on what you call a byte.

 > "Byte --- the unit of data storage in the execution
 > environment large enough to hold any member of the basic
 > character set of the execution environment."

I've always defined one byte - or, strictly, "octet" - is 8 bits.
Therefore char != byte on all platforms, so I guess it does indeed come
down to what you call a "byte". I worked on one machine not too
long ago that had 32 bit "4 bytes" chars, and sizeof(char) was
still 1. In fact, that was the entire unit of memory, yet the CPU still had
an "octet interleved" mode in which it was possible to align
structures on 8-bit byte boundaries. For backwards compatibility, of course
- even byte fetch instructions like movsz on the 80[3456]86, octet swapping
and inbuilt "network word order" transposition instructions.

64 bit ints and longs will be the norm in the not too distant future. And
you thought 32 bits was fun?!  :-)

Code breakage in the year 2000 will probably be nothing compared to a
change to 32-bits as the basic sizeof(int). Still we're lucky enough as it
is that the basic multiple is being maintained as a power of two rather
than some bizairre architectures which have a 9 or 12 bit char. Thus, the
motivation for portability is vindicated. Unfortunately, there's a *lot* of
code out there that isn't portable, but that I guess is a headache the
maintainers have to face when the time comes. The realities of publishing
code is that usually it becomes a trade-off between getting something
working sooner and perhaps spending the energy later in porting it to a
different environment. Sometimes that energy never need be expended at all
since the half-life of most code isn't very long.

--- MaltEd/2 1.0.b6
* Origin: Unique Computing Pty Limited (3:632/348)
SEEN-BY: 50/99 620/243 623/630 632/103 107 348 360 633/371 634/388 396
SEEN-BY: 635/301 502 503 544 639/252 711/409 410 413 430 808 809 932 934
SEEN-BY: 712/515 713/888 714/906 800/1
@PATH: 632/348 635/503 50/99 711/808 934

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™.