From 97b24a345f2c7aa6141f4c6e46438276cccb3bca Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Thu, 22 Jan 2026 19:47:55 +0000 Subject: [PATCH] copilot instructions --- .github/workflows/code-conventions-analyzer.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/code-conventions-analyzer.md b/.github/workflows/code-conventions-analyzer.md index c6534e923..d87b2d161 100644 --- a/.github/workflows/code-conventions-analyzer.md +++ b/.github/workflows/code-conventions-analyzer.md @@ -376,6 +376,12 @@ Identify opportunities specific to Z3's architecture and coding patterns: - Alternatives: `std::expected`, `std::optional`, error codes - Performance and clarity improvements +**Inefficient Stream Output:** +- Using strings to output single characters, such as << "X", + as well as using multiple consecutive constant strings such as << "Foo" << "Bar". +- Alternatives: << 'X' and << "Foo" "Bar" +- Performance improvement and binary size reduction + ## Analysis Methodology 1. **Sample key directories** in the codebase: @@ -693,6 +699,12 @@ For each opportunity, provide: - **Performance**: [Impact of exception-based control flow] - **Refactoring Opportunities**: [Specific patterns to replace] +### 4.13 Inefficient Stream Output +- **Current Usage**: [string stream output operator used for single characters] +- **Modern Alternatives**: [use char output operator] +- **Performance**: [Reduce code size and improve performance] +- **Refactoring Opportunities**: [<< "X"] + ## 5. Priority Recommendations Ranked list of improvements by impact and effort: @@ -945,6 +957,12 @@ grep pattern: "try.*\{.*for\(|try.*\{.*while\(" glob: "src/**/*.cpp" grep pattern: "catch.*continue|catch.*break" glob: "src/**/*.cpp" ``` +**Find inefficient output string operations using constant strings:** +``` +grep pattern: "<<\s*\".\"" glob: "src/**/*.cpp" +grep pattern: "<<\s*\".*\"\s*<<\s*\".*\"" glob: "src/**/*.cpp" +``` + ## Security and Safety - Never execute untrusted code