Skip to content

Auto Format hates multi-dimensional arrays (at least in osx) #1133

Closed
@hutchfx

Description

@hutchfx

In issue # 939 [email protected] points out that the when defining an array, Auto Format will change this:

int foo[] = { 1, 2, 3, 4, 5};

into this:

int foo[] = {
1, 2, 3, 4, 5};

Fortunately, once that is done it stays that way. For multi-dimensional arrays the behavior is worse. The first time Auto Format is run, this:

int foo[2][5] = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}};

becomes this:

int foo[2][5] = {
{
1, 2, 3, 4, 5 }
, {
6, 7, 8, 9, 10 }
};

Every subsequent time Auto Format is run it adds white space inside the braces, so after several times you have this:

int foo[2][5] = {
{
1, 2, 3, 4, 5 }
, {
6, 7, 8, 9, 10 }
};

Auto Format is never happy with it's own results (perhaps it's parents demanded too much of it as a child).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions