TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - C Coding Standard
Search

Guideline:  8.2#1Checked automatically with code checker

Synopsis:const and volatile, if present, should appear before other type-specifiers.
Language:C
Severity Level:7
Category:DECLARATIONS


Description:
Declarations are easier to read if const and volatile appear before other type-specifiers. ANSI C separates these out as type-qualifiers.Note that the choice between using const, a basically sound programming practice and #define is not always obvious as they represent different types of constant expression.

Example:

const int bufsiz = 512;
char a[bufsiz]; /* ILLEGAL in C (but not in C++) */
...
#define BUFSIZ 512
char a[BUFSIZ]; /* legal in C and C++ */
Note that the reader should also be aware that there are some examples of their use which are subject to interpretation requests.