[previous] 0618 [next] [C99] 'volatile' 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 'volatile' 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 volatile int                     v1;
extern int volatile                     v2;
extern volatile volatile int            v3;     /* Message 0618 - second volatile is redundant */
extern volatile int volatile            v4;     /* Message 0618 - second volatile is redundant */
extern int volatile volatile            v5;     /* Message 0618 - second volatile is redundant */


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

typedef volatile int T1;
extern volatile T1                      x1;     /* Message 0618 - volatile is redundant */

See also:

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