AI C++ code Generation Rules
Purpose
When AI is used to generate C++-code I set the context with some rules first to get a for me correct result.
Definitions
Types of 'Casings'
Names and examples of named case-types.
Pascal Case (Studly Caps)
Camel Case
Upper Snake Case
Lower Snake Case
Kebab cases
Rules
Apply the following instructions on generating the C++ code:
- Use only up to C++17.
- Enforcing Allman bracing.
- Doxygen-style comments in the headers only, using the '@' character for command.
- Use
#pragma onceas header sentries. - Use tabs for indentation.
- Use tabs size is 2 characters.
- Use no open lines in function bodies.
- Comments in code are always placed above the code line and never behind it.
- Comments are always full sentences ending with a period.
- Camel-case naming is used for object methods.
- Camel-case naming is used for object data-members and starts with an underscore.
- Lower-snake-case is used for class method and function argument names and also for the variables declared in them.
- Const expression and define names are in Upper-Case-Snake.
- Pascal Case is used for naming classes and structures.
- Pascal Case is used for naming enumerate types and prefixed with the letter 'E'. and the
- The enumerate value names Pascal Case but prefixed with lowercase abbreviation of the enumerate type without the 'E' prefix. Enumerate example: The enumerate type name is for a 'value type' resulting in abbreviation 'vt'. In case the type is only a single word use the first letter. The type has value named values for 'signed integer' and 'floating point'. Applying the enumerate rule: gives in "enum EValueType { vtSignedInteger, vtFloatingPoint}"