This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Lots of bugs in <limits.h> ?
> > Reading the C standard carefully leads me to believe that the macros
> > like
> >
> > UINT_MAX, LONG_MIN
> >
> > etc. should be values, and not typed integer constants like "65535U"
> > nor expressions like "(-LONG_MAX - 1)".
>
> They are "constant expressions suitable for use in #if preprocessing
> directives", "expressions that have the same type as would an expression
> that is an object of the corresponding type converted according to the
> integer promotions", as required by C99. As I've already pointed out on
> libc-alpha
> <http://sources.redhat.com/ml/libc-alpha/2002-12/msg00088.html>,
> Dinkumware's page is simply wrong about the requirements for the
> <stdint.h> macros, which are specified as applying to constants (not
> constant expressions), both before and after TC1.
Indeed. I'd been too obsessed with the use of the word "value" and
the example values given, which don't contain suffixes. The word
"value" is also used in the description of the UINTMAX_C etc. macros,
which is confusing.
The examples should be updated to not use "value" and have a suffix IMO.
Neil.