[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: not enough real programmers? (was Re: Byte Magazine: 18 Vintage issues, 1985-1986)
In comp.arch.embedded Luc Van der Veken <lucvdv@null.net> wrote:
> I may be wrong, but I believe you believe he believes wrong
> wrong.
> In C++, [the size of, for all] a char is smaller than or equal to
> a short, which is smaller than or equal to an int, which is
> smaller than or equal to a long (so a char and a long *can* have
> the same size) - and AFAIR C is generally less restrictive than
> C++.
K & R says: "The intent is that 'short' and 'long' should provide
different lengths of integers where practical; 'int' will normally reflect
the most "natural" size for a particular machine. (...) each compiler is
free to interpret 'short' and 'long' as appropriate for its own hardware.
About all you should count on is that 'short' is no longer than 'long'.
The C++ draft standard says:
There are four signed integer types: �signed char�, �short int�, �int�,
and �long int.� In this list, each type provides at least as much storage
as those preceding it in the list. Plain ints have the natural
size suggested by the architecture of the execution environment* ; the
other signed integer types are provided to meet special needs.
*that is, large enough to contain any value in the range of INT_MIN and
INT_MAX, as defined in the header <climits>.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Spehro Pefhany "The Journey is the reward"
speff@interlog.com
Fax:(905) 271-9838 (small micro system devt hw/sw + mfg)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=