Search code examples
c++formattingclion

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?


Solution

  • 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.