ReSharper 2020.1 Help

Code Style

ReSharper | Options | Code Editing | C++ | 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.

Include directives
Use forward slash 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, the new items are created with the forward declaration in the header file.

Use paths relative to the source file

You can use this selector to configure how ReSharper inserts paths to source files when importing types with a quick-fix or with import symbol completion.

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.

Sort include directives
Enable inspection 'Order of #include directives does not match code style settings'

Select this option to highlight any #include directives that violate the sorting order.

Preserve existing #include groups during a sort

This option lets you configure whether the default sorting action should regroup all directives or sort each group separately.

Case-sensitive sort

Select this option to sort all include directives of the same category as follows: place includes starting with uppercase letters before those starting with lowercase letters.

Group headers by directory

Select this option to create groups of headers based on their file path.

Sort order

Customize the sorting rules: order precompiled headers, the main header for the current file, add blank lines to separate your groups and find the place for all #include directives with names that match a regular expression pattern.

Main source file suffix

Specify a regular expression pattern to determine the main header for the current file.

Position of cv-qualifiers
Put cv-qualifiers before type

If this option is selected, the const, volatile, and mutable qualifiers are put before the type specifier. Otherwise, they are put after the type specifier.

Put 'const' before 'volatile'

Defines the order of cv-qualifiers.

Initialization
Default pointer initializer

You can specify 0, nullptr or NULL as the preferred initializer for pointer initializers, for example: const char *foo = nullptr.

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 NSDMIs

This option lets you configure how ReSharper generates non-static data member initializations (NSDMIs) when applying its features. Fore example, when you apply a quick-fix Alt+Enter on the uninitialized field in the following code

class test { int field; };
ReSharper will generate a uniform initialization int field{0}; when the option is enabled, and int field = 0; if the option is disabled.

Refactorings
Insert type alias instead of typedef in the 'Introduce Type' refactoring

Use this checkbox to make the Introduce Typedef refactoring use type alias instead of typedef. For more information, see Aliases and typedefs (C++) on Microsoft Docs.

Generate
Use trailing return types in generated function declarations

If this option is enabled, various code generation features will create function declarations with trailing return types instead of using the classic return type style.

Last modified: 27 May 2020