Syntax Style
Preferences configurable on this page help you enforce code syntax style — how to use interchangeable language syntax constructions. These preferences are taken into account when ReSharper produces new code with code completion and code generation features, applies code templates and performs refactorings. They can also be applied to the existing code by using code cleanup with the corresponding settings.
The preferences with the Notify with selector have corresponding code inspections that notify you if this aspect of the syntax style in the inspected scope differs from the preferred style. Using the selectors, you can configure severity levels of the inspections.
Sort include directives | Select this option to highlight any |
Type of slashes to use in include directives | Use this checkbox to choose the preferred path separator for include directives: forward slash or backward slash. |
Prefer to use forward declarations if possible | If this option is selected, auto-import puts the option to add a forward declaration before the option to insert an include directive. |
Use paths relative to the source file | You can use this selector to configure when ReSharper may use relative paths in generated include directives. |
Use angle brackets instead of quotes | By default, generated include directives are added in quotes, if necessary, you can use this selector to specify cases where generated include directives are added in angle brackets. |
Default pointer initializer | You can specify |
Use uniform initialization in member initializers | By default, ReSharper uses C++03 style when generating initializers (for example when you generate constructors or apply a quick-fix that inserts initializer into an existing constructor). You can select this checkbox to enable uniform initialization in the above-mentioned cases. |
Prefer uniform initialization in non-static data member initializers | This option lets you configure how ReSharper generates non-static data member initializers (NSDMIs) when applying its features. For example, when you apply a quick-fix Alt+Enter on the uninitialized
class test {
int field;
};
ReSharper will generate a uniform initialization |
Sort member initializers by the order of initialization | This option lets you enforce the order of member initializers in constructor initializer lists. Class members are initialized in the order they are declared in their containing class, so to minimize confusion and errors the common practice is to keep member initializers in the same order. |
'auto' usage in variable types | Preferences in this section let you configure the usage of |
Position of cv-qualifiers | Preferences in this section let you configure whether the |
Function declaration syntax | Use this option to configure whether to use trailing or regular return types in function declarations. |
Prefer typedefs or type aliases | Use this option to specify the preferred way to define type synonyms: in the form of alias templates or type aliases. It also affects which syntax is used by the Introduce Typedef refactoring. |
Nested namespaces | Use this option to enforce the C++17 syntax for nested namespaces, which allows you to declare multi-level namespaces in a more concise manner. |
Overriding functions | Preferences in this section let you configure which specifiers should be required on overriding functions and destructors. |
Braces | Preferences in this section let you define which braces can be omitted around single nested statements under the |
Remove redundant | Use this option to configure whether ReSharper should remove optional braces that do not comply with the chosen preference. |