Declaration with three or more levels of pointer indirection

ID

c.maintainability.excessive_pointer_indirection

Severity

low

Remediation Complexity

hard

Remediation Risk

medium

Remediation Effort

medium

Resource

Complexity

Language

C / C++

Description

This declaration has three or more levels of pointer indirection (* or deeper). Each extra * adds a dereference the reader has to track, and code this indirect is easy to get wrong and hard to review. Introduce a named type (typedef/using) for the intermediate pointer, pass an index or handle instead, or restructure the data so fewer levels are needed.

Rationale

This declaration has three or more levels of pointer indirection (* or deeper). Each extra * adds a dereference the reader has to track, and code this indirect is easy to get wrong and hard to review. Introduce a named type (typedef/using) for the intermediate pointer, pass an index or handle instead, or restructure the data so fewer levels are needed.

The following code illustrates the pattern detected by this rule:

void triple_uninitialized(void)
{
    // FLAGGED: Declaration with three or more levels of pointer indirection
    int ***table;
    table = 0;
}

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.

References

© 2026 Xygeni. All rights reserved