DEV Community

Discussion on: Tabs VS Space

Collapse
 
miffpengi profile image
Miff • Edited

My big concern has always been what the Tabs Are Evil article calls "continuation lines". I think code like this (from that article) is ugly and hard to read.

int f(int x,
      int y) {
    return g(x,
             y);
}

Instead, why not structure it like this?

int f(
    int x,
    int y
) {
    return g(
        x,
        y
    );
}

Isn't that much easier to read? With indentation levels you know exactly what everything is.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Yes, exactly. If you wish to align things just start them all on the next line.

The space approach is entirely annoying, not because they're spaces, but because all functions have different alignments.

int go( int f,
        int y );

int somewhatLongerName( int f,
                        int y );

This sucks for readability, but also has a very real cost in maintenance and source control. If you wish to rename a function you have to modify the alignment of all the parameters again, this needless increases the patch size, thus wastes reviewer capacity.