Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLion formatting of pointer/references

From reformatting, I want:

int* n;
int& m;
int const* o;

instead, I get:

int *n;
int &m;
int const *o;

How to make CLion do what I want?

like image 211
hamster on wheels Avatar asked Aug 13 '17 02:08

hamster on wheels


People also ask

How do I format my code in Clion?

CLion can format your code according to the configured code style settings. You can also apply your code style formatting to the specified files from the command line. The command-line formatter launches an instance of CLion in the background and applies the formatting. It will not work if another instance of CLion is already running.

How do I indent preprocessor directives in CLion?

In this field type the indent of preprocessor directives. Select this checkbox to keep the indent of preprocessor directives equal to that of surrounding code lines. Use this tab to specify where you want spaces in your code. To have CLion automatically insert a space at a location, select the checkbox next to this location in the list.

How do I add a space to the source code in CLion?

To have CLion automatically insert a space at a location, select the checkbox next to this location in the list. The results are displayed in the preview pane. In this tab, customize the code style options, which CLion will apply on reformatting the source code.

What is the default margin value CLion uses on typing?

Default: in this case CLion uses the Wrap on typing option that is specified in the global settings. Yes: in this case CLion uses the value specified in the Right Margin field.


1 Answers

Prevent Auto Format from align Pointer to variable points to https://www.jetbrains.com/help/clion/2016.3/code-style.html

After searching the many options... in Settings

Editor -> Code Style -> C/C++ -> Spaces ->

From:
    before '*' in declarations
    before '&' in declarations

to:
    after '*' in declarations.
    after '&' in declarations.
like image 54
hamster on wheels Avatar answered Oct 11 '22 19:10

hamster on wheels