---
name: cppcheck
description: "Use when adopting Cppcheck to assess this standard: Catch undefined behavior in native code"
---

# Apply Cppcheck

Analyze the project with matching platform definitions and include paths. Investigate out-of-bounds accesses and uninitialized variables against the actual build configuration.

## Procedure

1. Inspect the repository configuration and identify the files or targets covered by Cppcheck.
2. Use Cppcheck in this repository to meet this standard: Catch undefined behavior in native code. Analyze the project with matching platform definitions and include paths. Investigate out-of-bounds accesses and uninitialized variables against the actual build configuration. Inspect the repository configuration, record the baseline and exact reproduction steps, then add the smallest repeatable check that detects a regression.
3. Record the tool version, configuration, scope and findings. Explain any checks that could not run.
4. Use the same invocation after changes and compare the evidence against the baseline.

Refer to [the upstream documentation](https://cppcheck.sourceforge.io/) for configuration and prerequisites.

## Worked check

Reproduce the sample array-bounds diagnostic on the single C file. Compare its declared length with the flagged index, fix the access, and rerun with the same platform and preprocessor choices before accepting a clean result.

[Evidence and example](https://cppcheck.sourceforge.io/manual.html)
