question

JohnHite-1908 avatar image
0 Votes"
JohnHite-1908 asked JohnHite-1908 commented

C++ unwanted spaces between braces

When I type
int i{3}

The editor presumes I want
int i{ 3 }

The editor would be wrong.

Please make it stop!

Something could be done about tags too. I had to guess around until I found something that would be accepted and its not really relevant. At least give us a list to choose from, please.

c++
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered JohnHite-1908 commented

You can make it stop yourself: in Visual Studio 2019, go to menu, TOOLS, Options, Text Editor, C/C++, Code Style, Formatting, Spacing, Spacing for braces, and uncheck "Insert space within braces of uniform initialisation and initialiser lists". You will also find more options that can be adjusted to your personal needs.

To reformat the existing code after these changes, press <Ctr+E, D>.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Many thanks.

0 Votes 0 ·