[previous] 3260 [next] Typedef defined with more than 2 levels of indirection.
Pointers REFERENCE - ISO:C90-6.5.4.1 Pointer Declarators

This typedef is defining a type which has more than 2 levels of pointer indirection.

Pointers defined with multiple levels of indirection can be error prone and hard to understand

For example:


/*PRQA S 553,2017,2022,3205,3210,3211,3408,3447,3448 ++*/

typedef int * *   T2;                   /*              */
typedef int * * * T3;                   /* Message 3260 */
typedef T2 *      T3A;                  /* Message 3260 */

struct ST
{
    T2        m2;                       /*              */
    T3        m3;                       /* Message 3261 */

    int * *   n2;                       /*              */
    int * * * n3;                       /* Message 3261 */
};

T2        x2;                           /*              */
T3        x3;                           /* Message 3262 */

int * *   y2;                           /*              */
int * * * y3;                           /* Message 3262 */

extern T2        f2(void);              /*              */
extern T3        f3(void);              /* Message 3263 */

extern int * *   g2(void);              /*              */
extern int * * * g3(void);              /* Message 3263 */



MISRA C:2012 Rules applicable to message 3260:

Rule-18.5  (Advisory) Declarations should contain no more than two levels of pointer nesting


See also:

QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents