From 78f579400c62297f76da4921d3f8e9aa86895628 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Tue, 3 Feb 2026 09:03:37 -0700 Subject: [PATCH] cursor coding-standards Signed-off-by: James Cherry --- .cursor/rules/cpp-coding-standards.mdc | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .cursor/rules/cpp-coding-standards.mdc diff --git a/.cursor/rules/cpp-coding-standards.mdc b/.cursor/rules/cpp-coding-standards.mdc new file mode 100644 index 00000000..34c6cfe6 --- /dev/null +++ b/.cursor/rules/cpp-coding-standards.mdc @@ -0,0 +1,33 @@ +--- +description: C++ coding standards and formatting for OpenSTA +globs: ["**/*.cc", "**/*.hh", "**/*.h"] +alwaysApply: false +--- + +# C++ Coding Standards + +## Line Width + +- **Keep lines under 90 characters** to match `.clang-format` (ColumnLimit: 90). +- Break long lines at logical points: after commas, before operators, after opening parens. + +## Naming Conventions + +- **Classes**: Upper camel case (`ClassName`) +- **Member functions**: Lower camel case (`memberFunction`) +- **Member variables**: Snake case with trailing underscore (`member_variable_`) +- **Functions**: Lower camel case (`functionName`) +- **Variables**: Snake case + +## Code Style + +- Use `#pragma once` for header guards. +- Return type on the line before the function name; arguments on separate lines when long. +- No braces for single-line if/for; use braces for multi-line bodies. +- Prefer `std::string` over `char*` for string members. +- Prefer pass-by-value and move for sink parameters (parameters that get stored). + +## File Extensions + +- C++ source: `.cc` +- C++ headers: `.hh`