C/C++ Cursor Rules
April 15, 2026
C/C++ Cursor Rules
Code Style
- 4 spaces indentation
- snake_case for functions/variables
- PascalCase for types/classes
- SCREAMING_SNAKE_CASE for macros
- 100 char line limit
Best Practices
- Use modern C++ (C++17+)
- Prefer smart pointers over raw pointers
- Use RAII for resource management
- Use std::vector over raw arrays
- Use std::optional for nullable values
- Prefer constexpr for compile-time
AI Instructions
- Include necessary headers
- Use forward declarations when possible
- Provide CMakeLists.txt for build
- Add Google Test or Catch2 tests
- Comment complex logic
Related Articles
Next.js Cursor Rules: Server Components, Routing, Fetching
Next.js cursor rules enforce server-first patterns, file routing, components, and efficient data fetching. Context-aware practices for maintainable code
Programming Languages Supported by Cursor Rules
Explore programming languages supported by Cursor Rules with language-specific guidelines, best practices, and examples for effective AI-assisted coding.
AI Rules Configuration: Enhancing Code Generation in IDEs
Learn to configure AI rules in modern IDEs. Optimize AI assistants for enhanced code generation, streamlined workflows, and consistent code quality.