[previous] 0617 [next] [C99] 'const' qualifier has been duplicated.
ISO C99 Language features REFERENCE - ISO:C90-6.5.3 Type Qualifiers, ISO:C99-6.7.3 Type Qualifiers

This is a constraint error in ISO:C90 but is permitted in ISO:C99. A redundant 'const' type qualifier has been used in this declaration.

Notice that the syntax of the C language allows a type qualifier to be located either before or after a type specifier, but to include it twice is unnecessary and confusing.

For example:


/*PRQA S 553,1305,3210,3211,3408,3447,3448,3602 ++*/


extern const int               v1;
extern int const               v2;
extern const const int         v3;     /* Message 0617 - second const is redundant */
extern const int const         v4;     /* Message 0617 - second const is redundant */
extern int const const         v5;     /* Message 0617 - second const is redundant */


extern const int *             p1;     /*              - pointer to const int */
extern int const *             p2;     /*              - pointer to const int */
extern int * const             p3;     /*              - const pointer to int */
extern const int * const       p4;     /*              - const pointer to const int */
extern int const * const       p5;     /*              - const pointer to const int */
extern const int const *       p6;     /* Message 0617 - second const is redundant */
extern const int const * const p7;     /* Message 0617 - second const is redundant */

typedef const int T1;
extern const T1                x1;     /* Message 0617 - const is redundant */


See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents