[splint-discuss] (U)INT_X_MAX constant types
lists at ingostruck.de
lists at ingostruck.de
Mon May 4 13:58:30 PDT 2009
Hello list,
recently I tried to check a program with the following two macros:
#define BUF_FAIL UINT_FAST64_MAX
#define BUF_MAX (UINT_FAST64_MAX-512)
an assignment to a uint_fast64_t variable is considered an error
by splint 3.1.2 (and recent CVS) due to non-matching types.
I had a look into splint's ./lib/standard.h and found the question
/*
** What should the types be here?
*/ /*#*/
before the (U)INT_X_MAX / MIN type constants.
The answer is simple: they must match the corresponding types.
See iso iec9899-1999, section 7.18.2:
--------
7.18.2 Limits of specified-width integer types
1 The following object-like macros specify the minimum and maximum limits of
the types declared in <stdint.h>. Each macro name corresponds to a similar
type name in 7.18.1.
2 Each instance of any defined macro shall be replaced by a constant expression
suitable for use in #if preprocessing directives, and this expression shall
have the same type as would an expression that is an object of the
corresponding type converted according to the integer promotions. Its
implementation-defined value shall be equal to or greater in [...]
--------
--> imho the @constant annotations should be fixed to match the
correct type.
I could provide a patch, if this is wanted.
Kind regards
Ingo Struck
More information about the splint-discuss
mailing list