c++code-formattinguncrustify

Uncrustify code formatter removes space in C++ one-liner


How to prevent Uncrustify code formatter from keeping one space in C++ one-liner between { and the rest code?

So, it changes this code

const Foo &GetBar() const { return bar; }

to this

const Foo &GetBar() const {return bar; }

I search for return in default uncrustify config, but found nothing in common with my problem.


Solution

  • I think that this has more to do with brace spacing than with the return, so I'd check the space settings for braces. The first option I would try to play with would be sp_inside_braces (should be "ignore" by default).