J
Joachim Schmitz
INT_MAX is for int, not short, or unsignd shortpete said:Joachim said:N1256pete said:Joachim Schmitz wrote:
pete wrote:
Joachim Schmitz wrote:
On top of that: here it is about 2 or 4, which even on the DS9K
would easily fit into INT_MAX.
Not on the DS9K.
unsigned short can have INT_MAX padding bytes on the DS9K. Chapter
Chapterand verse please
N869
6.2.6.2 Integer types
[#1] For unsigned integer types other than unsigned char,
the bits of the object representation shall be divided into
two groups: value bits and padding bits (there need not be
any of the latter). If there are N value bits, each bit
shall represent a different power of 2 between 1 and 2N-1,
so that objects of that type shall be capable of
representing values from 0 to 2N-1 using a pure binary
representation; this shall be known as the value
representation. The values of any padding bits are
unspecified.
5.2.4.2.1 Sizes of integer types <limits.h>
...
Their implementation-defined values shall be equal or greater in
magnitude (absolute value) to those shown, with the same sign.
...
- maximum value for an object of type int
INT_MAX +32767 // 2^15 - 1
So even on a DS9K printf's %d has to be able to display numbers up
to 32767.
printf's %d being able to display numbers up to 32767,
is irrelevant as to how many padding bytes
(or bytes composed of padding bits),
an object of type unsigned short is allowed to have.
(%d prints an int, not an unsigned short)
Ah, so you're saying that an int, in addition to it's minimum of 15 value
bits can have as many pading bits (whos's _values_ are unspecified) as it
likes, making the entire sizeof(int) larger than 32727 (as long as it still
fits a size_t)? And not that 'padding _bits_' implies that they are only
allowed to fill up to the next byte size? (the values are explicitly
unspecivied, what about the number?)
Bye, Jojo