SShortSingh.
Back to feed

include-tidy Tool Tackles Complex Include-What-You-Use Rules for C++

0
·1 views

A developer has shared findings from extending include-tidy, a tool that enforces the include-what-you-use (IWYU) principle, to C++ codebases after previously testing it mainly on C code. The work was prompted by a bug report for SWISH++, a decade-old C++ project, which revealed several dozen IWYU violations upon analysis. Unlike C, C++ features such as nested types, inheritance, and operator overloading create legitimate exceptions to strict IWYU enforcement that naive rule application fails to handle correctly. For instance, a derived class source file that transitively includes a base class header through its own header should not be required to explicitly include the base header again. These findings highlight that codifying intuitive C++ include practices into automated tooling is significantly more complex than it first appears.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Why AI Agents Need Stricter Architecture Decision Records Than Humans Do

A senior software engineer and tech lead building toward fully autonomous 'Level 5' AI development has published a detailed framework for writing Architecture Decision Records (ADRs) specifically designed for AI agents. Unlike human-readable ADRs, agent-readable versions require four additional sections: an invariant statement, a list of 'dangerous improvements,' yes/no agent check questions, and a consequence table of observable violations. The need for this stricter format was demonstrated through a real codebase incident, where an AI agent optimizing an order creation endpoint made a locally reasonable change that broke a critical system invariant. The author credits Dan Shapiro's 'Five Levels' framework and AI strategist Nate B. Jones for the conceptual foundation behind the newsletter series. The core argument is that agents cannot infer intent or ask clarifying questions mid-implementation, making explicit, machine-legible constraints essential before violations are embedded in code.

0
ProgrammingDEV Community ·

Developer builds local MCP memory layer to cut AI context costs in coding sessions

A developer has built an open-source tool called zerikai_memory to solve the recurring problem of re-establishing project context at the start of every AI coding session, which wastes tokens and increases API costs. The tool runs as a memory layer behind Claude Desktop via the Model Context Protocol (MCP), storing indexed project knowledge locally rather than relying on the AI's context window. It uses Tree-Sitter to parse source files into Concrete Syntax Trees without any LLM inference, supporting Python, JavaScript, TypeScript, HTML, and Markdown. A multi-stage retrieval pipeline — combining vector search, lexical re-ranking, and source citations — ensures only the most relevant context is surfaced to the IDE or chat session. The system supports fully local operation via Ollama, cloud mode via DeepSeek, or a hybrid setup, and is designed to keep API bills manageable while preserving session continuity.

0
ProgrammingDEV Community ·

How to Diagnose and Fix Next.js Performance Issues the Right Way

Developers often approach Next.js optimization too broadly, making multiple changes at once without knowing which one actually helped. A more effective method involves identifying a specific slow route and symptom before touching any code. Key diagnostic steps include recording baseline metrics such as TTFB, LCP, bundle size, and request count, then determining whether the bottleneck lies on the server or in the browser. Tools like bundle analyzers and simple timing helpers can pinpoint whether the issue stems from a slow CMS, oversized client components, or third-party scripts. The guide also recommends keeping components server-side by default and only using client components where browser interaction is genuinely required.

0
ProgrammingDEV Community ·

How to Refactor a Bloated Next.js Middleware File Using the NEMO Pattern

Next.js middleware files often start simple but grow unwieldy as redirects, locale handling, authentication, and security headers accumulate in a single file. The core problem is mixed responsibility, where unrelated logic coexists without a clear execution order, making changes risky and hard to test. A practical solution involves splitting middleware into discrete rules, each handling one concern, arranged in an explicit priority sequence. The NEMO library formalizes this composition pattern, treating middleware as an ordered set of independent proxy rules rather than a chain of nested conditionals. Keeping internal paths like static assets and health checks at the top of the rule list reduces unnecessary processing and prevents unintended side effects.