LLMs are bad with C/C++ specially while working with large private codebases. There are two broader reasons.
Reason 1: context handing:
consider this actual failure from an HFT:
// risk/checked.hpp
namespace risk {
template <class T> struct Checked {};
template <class T> bool validate(const Checked<T>&); // generic checks only
}
// gw/order.hpp
namespace gw {
struct Order : risk::Checked<Order> {};
}
// gw/order_validate.hpp
namespace gw {
bool validate(const Order&); // also checks the venue price band
}
// gw/order_router.cpp
#include "gw/order.hpp"
#include "gw/order_validate.hpp" // delete this line
namespace gw {
bool route(const Order& order) {
return validate(order); // still compiles
}
}
If you deleting include line then validate(order) still compiles. Ordinary lookup no longer finds gw::validate, but ADL looks in the namespace of Order's base class, finds risk::validate<T>, deduces T = Order, and the price band check is gone.
Adding clangd to Claude Code worsens performance
on 255 issues from 40 C and C++ projects, 359 repair attempts with and without the clangd tool. With it: 270 fixed. Without: 275. Across all tasks, cost went up 11%.
When the tool was optional, Claude Code used it in 5% of runs (separate test, 30 search tasks).
When told to use it, fell back to text search in 70% of runs.
On 29 tasks built around same-name functions (find the callers of one specific function, ignore the others with the same name), plain Claude Code found 96.6% of callers. Requiring clangd added 0.6 points.
Interestingly, for 126 of the 255 issues, the model could name every location that needed changing from the issue text alone, without seeing the repo from memory only. A lot of public issues don't test code navigation much.
Paper: https://byteask.ai/research/lsp-claude-code-cpp
2. Ranking code based on AST+build system
I implemented an index which reads the project through its build (compile_commands.json, flags, macros, what each call resolves to), AST, semantic embedding with decoders derived from C/C++ and ranks where a change probably belongs with respect to git history and comments from PR. On 30 real issues from open-source C and C++ projects, held out from development, it ranked a file that needed changing first 57% of the time. sgrep: 30%. Probe: 20%.
It indexed the Linux kernel build in 9.3 minutes and LLVM in 13.7 on one 48-CPU machine. Comparable products like Graphify hadn't finished LLVM after 3 hours. After a .cpp edit it re-indexes in 5.8 seconds, and 9 of 10 answers after an edit matched the new code, vs 0 of 10 from a stale index.
Papers: https://byteask.ai/research/context-engines-cpp and https://byteask.ai/research/context-large-codebases-cpp
Reason 2: Lack of right tools.
Claude Code and Codex can run gdb or perf as one-off shell commands, but out of the box they can't drive an interactive gdb session or work with perf data directly. I open-sourced a fork of Codex with them built in as native tools: https://github.com/ByteAsk/cli. PRs adding more tools are welcome. Interestingly with working at harness level, you can add different and multiple models, context engineering for working around larger contexts with better control.
3. Same model, same fixes, fewer tokens
I compared with above index + new harness with OpenAI's Codex CLI running the same model. This setup used 63 to 80% fewer tokens and cost 59 to 70% less. The gap was biggest on little-known projects the model is unlikely to have memorized.
Paper: https://byteask.ai/research/byteask-system-cpp
If you've tried AI tools on C/C++/CUDA codebase, where did they fall over? my guesses for the hard cases are macro-generated code, CRTP and heavy ADL, unity builds, C++20 modules, and projects without a usable compile_commands.json.