{"slug": "a-one-number-triage-tool-for-c-code-and-a-cheap-feedback-loop-for-llm-output", "title": "A one-number triage tool for C code (and a cheap feedback loop for LLM output)", "summary": "A developer released c-score, a single-file, dependency-free Python tool that scores C functions on a single number derived from nesting depth, pointer depth, and dereference chains, and validated it against maintenance churn in libXt and libtiff plus 20+ years of git history for libtiff, curl, redis, and OpenMotif. The developer reports that the same score can be used as a cheap feedback loop to steer LLM-generated C toward flatter output in one rewrite round, while cautioning it is a triage aid rather than a bug detector.", "body_md": "C gets hard to trust in three predictable ways: deep nesting, pointers to\n\npointers, and `a->b->c` chains where nobody null-checks the middle pointer.\n\nSo I wrote a tiny scorer that squashes that into one number per function:\n\n```\nscore(f) = nesting × pointer depth × deref chain\n```\n\nEach factor is one sentence:\n\n`if`/` for`/` while` levels`int *`, `int **`, `int ***` in params and locals (deeper is closer to a memory bug)`a->b->c` runs, i.e. null-derefs where the middle pointer came from somewhere else\nIt's one file, zero dependencies, no parser worth mentioning.\n\nI checked it against maintenance churn — how often a function actually gets\n\ntouched — on two very different codebases (libXt, a 40-year-old X11 toolkit,\n\nand libtiff, a format parser):\n\nI also ran it across 20+ years of git history for libtiff, curl, redis and\n\nOpenMotif. None of them trend toward smaller functions — the median stays flat\n\nand **the biggest function only ever grows**. Which is exactly why a cheap pointer\n\nto the hot spots helps.\n\nLLM-generated C has the same tell. The loop is:\n\n```\ngenerate → c-score file.c → \"rewrite the top 3\" → re-score\n```\n\nOne round visibly flattens the output. A dumb, explainable number is enough to\n\nsteer an LLM — you don't need a real static analyzer for this.\n\nIt's a triage tool, not a bug detector. It won't find semantic bugs, and it\n\ncan't see a deep call stack full of side effects. The parser is not perfect,\n\nand the Python is LLM-generated too. But the idea is the sound part — before\n\nyou pick it apart, run it on a real codebase.\n\n```\npip install c-code-score\nfor f in src/*.c; do c-score \"$f\"; done \\\n  | awk '/^[^ ]/{n=$1} /^  score:/{print n,$2}' \\\n  | sort -k2 -rn | head\n```\n\nRepo: [https://github.com/xtforever/c-score](https://github.com/xtforever/c-score) · [https://codeberg.org/au1064/c-score](https://codeberg.org/au1064/c-score)", "url": "https://wpnews.pro/news/a-one-number-triage-tool-for-c-code-and-a-cheap-feedback-loop-for-llm-output", "canonical_source": "https://dev.to/jens_harms_c50ccbd4550050/a-one-number-triage-tool-for-c-code-and-a-cheap-feedback-loop-for-llm-output-1eco", "published_at": "2026-09-20 12:48:39+00:00", "updated_at": "2026-09-20 12:54:21.262854+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "large-language-models"], "entities": ["c-score", "libXt", "libtiff", "curl", "redis", "OpenMotif", "GitHub", "Codeberg"], "alternates": {"html": "https://wpnews.pro/news/a-one-number-triage-tool-for-c-code-and-a-cheap-feedback-loop-for-llm-output", "markdown": "https://wpnews.pro/news/a-one-number-triage-tool-for-c-code-and-a-cheap-feedback-loop-for-llm-output.md", "text": "https://wpnews.pro/news/a-one-number-triage-tool-for-c-code-and-a-cheap-feedback-loop-for-llm-output.txt", "jsonld": "https://wpnews.pro/news/a-one-number-triage-tool-for-c-code-and-a-cheap-feedback-loop-for-llm-output.jsonld"}}