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.
>
I ask because short/int/long has not a specific length in bytes, but:
short is smaller or equal to int
int is smaller or equal to long
Note that "bytes" is not any specific number of bits in C++.
There are practical lower limits on short and long (16 and 32 bits)
in addition to the char <= short <= int <= long.