You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Use typedef names to improve code readability.

Non-Compliant Code Example

The following declarations of the signal function s

void (*signal(int, void (*)(int)))(int);

Compliant Solution

This compliant solution makes use of the typedef name to specify exactly the same type as in the non-compliant coding example.

typedef void fv(int), (*pfv)(int);
fv *signal(int, fv *);
pfv signal(int, pfv);

Risk Assessment

Code readability is important for discovering and eliminating vulnerabilities.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

DCL05-A

1 (low)

1 (low)

2 (medium)

P2

L3

References

[[ISO/IEC 9899-1999:TC2]] Section 6.7.7, "Type definitions"

  • No labels