[previous] 3111 [next] Redundant comma at end of braced initializer will be ignored.
Arrays, structures, unions and bit-fields REFERENCE - ISO:C90-3.5.7 Initialization

This braced initializer includes a redundant trailing comma. The comma has no effect and will be ignored; however it may be wiser to remove it so as to avoid confusion.

For example:


/*PRQA S 2017,2213,3120,3132,3211,3408 ++*/

int a[3] = { 1, 2, 3, };                        /* Message 3111 */

int b[6] = { 1, 2, 3, };                        /* Message 3111 and 0686 */

int c[3] = { 1, 2,  , };                        /* Message 0907 and XXXX - Syntax error */

struct ST
{
    int x;
    int y;
    int z;
};

struct ST sta = { 1, 2, 3, };                   /* Message 3111 */

struct ST stb = { 1, 2,    };                   /* Message 3111 and 0703 */


See also:

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