On Tue, 09 Jan 2007 16:20:18 -0500, Ron Natalie <>
wrote in comp.lang.c++:
> Chameleon wrote:
> > char is 1 byte length in standard c/c++?
>
> By definition. A char is exactly one byte in size because
> that's how a byte in C++ is defined. However, it points out
> one glaring problem in C and C++. Char serves double duty:
> 1. It's the native character size.
> 2. It's the smallest addressable unit of storage.
>
> That means that you can't really use char's if you have 16 bit
> native characters unless you want to give up the ability to
> address on 8 bit boundaries. What makes this worse is that
> C++ rots big time on wchar_t support. Many important interfaces
> (filenames, program arguments) don't have any wide char interface.
In C and C++ implementations where chars have 16 (or 32) bits, exist
primarily on DSPs (Digital Signal Processors) that physically CAN'T
access memory in units smaller than the 16 or 32 bit machine words.
Typically they are used in embedded systems running in free-standing
environments where there aren't any filenames or program arguments,
anyway.
But if there was a hosted environment for a CHAR_BIT > 8 system, I am
quite sure that the underlying platform would find a way to deal with
these things, if necessary.
You'd be surprised how little difference 16 bit chars makes to code
designed and written with a little care.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://c-faq.com/
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html