terminator wrote:
::: long and int maybe both 32 bits
::
:: maybe differs from certainly are. for long there is no guarantee
:: to be the same size as int.there is an equal or greater than
:: restriction.And I am unhappy to see that while there is no
:: standard type for 64bit ints on x86 family we are using long with
:: the same size as int(32bits).
Type long has always been 32 bits in Windows, even back when int was
only 16 bits. Obviously MS believes that it is not a good time to
change that now, even when going to 64 bits.
They did't ask me for my opinion though. :-(
On other x86 systems, like 64 bit *nix we see 64 bit longs.
:: char types seem to be of the same size everywhere.
::
::: It's a distinct type. You can overload on it, for example:
:::
::: void f(char);
::: void f(unsigned char);
::: void f(signed char);
:::
::: declares three different functions. This is not true for the other
::: integer types, which are always signed, unless you specify
::: unsigned.
:::
::: On a particular compiler char is either signed or unsigned (or
::: perhaps selectable with a compiler option). Whichever it is, other
::: requirements make it behave the same as either signed char or
::: unsigned char (same value range, same representation), but it is
::: still a distinct type.
::
:: So,is it just an attempt to be economical in the number of
:: keywords in order not to declare a type for bytes?
:: Do they have same size on different platforms or there is no
:: standard ?
Not everyone agree that a byte is an octet, even though very popular
hardware has had it that way for a long time.
Some machines are not byte addressed, but word addressed. I have seen
character sizes not only 8 bits, but also 9, 16, and 32 bits. There
are possibly others as well.
Here's a series of mainframes compatible with what has been around for
40+ years, with 9 bit bytes and 36 bit ints:
http://www.unisys.com/products/mainframes/os__2200__mainframes/model__specifications.htm
When designing a language, it is important not to make the spec so
narrow that it just by accident makes it impossible to implement the
language on some machines.