I know in C
return type of sizeof
operator is size_t
being unsigned integer type defined in <stdint.h>
. Which means max size of it should be 65535
as stated in C99
standard 7.18.3:
limit of size_t
SIZE_MAX 65535
However in gcc-4.8.2
header file stdint.h
has defined its size much greater than 65535
contradicting to which is stated in C99
standard as below shown,
/* Limit of `size_t' type. */
# if __WORDSIZE == 64
# define SIZE_MAX (18446744073709551615UL)
# else
# define SIZE_MAX (4294967295U)
# endif
Kindly help me in understanding why there is a difference or reason behind my misinterpretation.
The standard says that SIZE_MAX
must be at least 65535.
It specifies no upper bound, and gcc's implementation is perfectly valid.
Quoting the reference you cited (emphasis added):
Its implementation-defined value shall be equal to or greater in magnitude (absolute value) than the corresponding value given below, with the same sign.