Prompt
Keep code clean and consistent with established project conventions. This includes:
- Follow existing formatting style in files:
// Follow Allman style if file uses it void function() { if (condition) { statement; } } -
Avoid
using namespacedeclarations as they pollute the namespace, even if the header is not included directly. - Remove dead/commented-out code or guard it with macros if needed for future use: ```cpp // Instead of leaving commented code blocks // for (int i1 = 0; i1 < STEP_SIZE; ++i1) { // if (ptr + i1 < n1) { // matOut[ptr + i1] = matA[ptr1 + i1] + matB[ptr2 + i1]; // } // }
// Use feature macros if code might be needed later #ifdef EXPERIMENTAL_FEATURE for (int i1 = 0; i1 < STEP_SIZE; ++i1) { if (ptr + i1 < n1) { matOut[ptr + i1] = matA[ptr1 + i1] + matB[ptr2 + i1]; } } #endif ```
-
Prefer C++ templates over complex multi-line macros for better debugging and type safety.
-
Use standard type names rather than shortcuts (e.g.,
unsigned charinstead ofuchar).
Consistency in code style significantly improves readability and maintainability while reducing review friction.