Install
$ agentstack add skill-kaynetik-skills-c-cpp-compilers ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
C/C++ Compilers
Guidance for compiling, analyzing, and optimizing C and C++ code with GCC and Clang in 2026.
Reference files
- GCC specifics: [gcc.md](reference/gcc.md) -- flags, diagnostics, PGO, LTO, error triage
- Clang specifics: [clang.md](reference/clang.md) -- diagnostics, optimization remarks, clang-tidy, macOS
- Sanitizers: [sanitizers.md](reference/sanitizers.md) -- ASan, UBSan, TSan, MSan, LSan decision tree and reports
- Static analysis: [static-analysis.md](reference/static-analysis.md) -- clang-tidy, cppcheck, scan-build, CI integration
- Modern C/C++: [modern-cpp.md](reference/modern-cpp.md) -- C++20 modules, C++23/26 features, C23, migration
Standards baseline (2026)
| Language | Preferred standard | GCC support | Clang support | |----------|--------------------|-------------|---------------| | C | -std=c23 (or -std=c17 for broad compat) | GCC 15+ | Clang 18+ | | C++ | -std=c++23 (or -std=c++20 minimum) | GCC 14+ | Clang 18+ |
Always pass the standard flag explicitly. Never rely on compiler defaults.
Build modes
| Goal | Flags | |------|-------| | Debug | -g -O0 -Wall -Wextra -Wpedantic | | Debug (GDB-friendly optimized) | -g -Og -Wall -Wextra | | Release | -O2 -DNDEBUG -Wall | | Release (max throughput, native) | -O3 -march=native -DNDEBUG -flto | | Release (min binary size) | -Os -DNDEBUG (Clang: -Oz) | | Sanitizer build | -g -O1 -fsanitize=address,undefined -fno-omit-frame-pointer |
Warning discipline
Start with -Wall -Wextra -Wpedantic. Add -Werror in CI.
Suppress narrow scopes only:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
void callback(int ctx, int unused) { (void)ctx; }
#pragma GCC diagnostic pop
Clang equivalent works the same. For project-wide suppression, prefer .clang-tidy config or -Wno- in build system, not in source.
Optimization decision tree
Need max throughput on known hardware?
yes -> -O3 -march=native -flto
no -> Have profiling data?
yes -> -O2 -fprofile-use (GCC) / -fprofile-instr-use (Clang)
no -> -O2
Size-constrained (embedded, shared lib)?
yes -> -Os (GCC/Clang) or -Oz (Clang only)
Numerical code that tolerates IEEE relaxation?
yes -> -Ofast (enables -ffast-math; breaks NaN/inf handling)
no -> stay with -O2/-O3
-O3 vs -O2: -O3 adds aggressive loop transforms and wider inlining. Benchmark before committing -- i-cache pressure can cause regressions.
LTO
# GCC
gcc -O2 -flto=auto -c foo.c bar.c
gcc -O2 -flto=auto foo.o bar.o -o prog
# Clang (ThinLTO preferred for large projects)
clang -O2 -flto=thin -fuse-ld=lld -c foo.c bar.c
clang -O2 -flto=thin -fuse-ld=lld foo.o bar.o -o prog
Use gcc-ar / gcc-ranlib for GCC LTO archives. Clang ThinLTO links 5-10x faster than full LTO with comparable code quality.
PGO (profile-guided optimization)
GCC:
gcc -O2 -fprofile-generate prog.c -o prog_inst
./prog_inst &1 | grep -A20 '#include '
Compiler-specific details
For GCC-specific flags, PGO nuances, and error patterns, see [gcc.md](reference/gcc.md). For Clang diagnostics, optimization remarks, macOS toolchain, and clang-tidy, see [clang.md](reference/clang.md). For C++20 modules, C++23/26, and C23 features, see [modern-cpp.md](reference/modern-cpp.md).
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: kaynetik
- Source: kaynetik/skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.