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: Note that the reader should also be aware that there are some examples of their use which are subject to interpretation requests.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++ */ |