Annoying Redundancies in C/C++

Pages: 12
That's not a good rule because it's very difficult to follow consistently and it will lead to incorrect mixing of tabs and spaces which is worse than anything.

Case in point... something similar to tath's recent post:

1
2
3
4
5
        someFunc(
                 foo,
                 bar,
                 baz
                );


To show that as intended with tabs, you have to remember to tab the first 2 times, but then space the rest of the way:

1
2
3
4
5
[\t][\t]someFunc(
[\t][\t]         foo,
[\t][\t]         bar,
[\t][\t]         baz
[\t][\t]        );


That's very hard to be consistent with. Especially if you don't have your editor draw the little white-space symbols.



EDIT:
On a side note...
That way code will look nice whatever tab size someone will set.


Using spaces will also always look nice regardless of what tab size someone sets.
Last edited on
Why not just create class templates, or use an abstract class as an interface and classes that inherit the abstract as view objects? In this way it will reduce the code you have to stare at in main, also makes it very easy to debug and modify.
> align with spaces.
too much work
1
2
3
4
5
[\t][\t]someFunc(
[\t][\t][\t]foo,
[\t][\t][\t]bar,
[\t][\t][\t]baz
[\t][\t]);
let your editor do its magic.
too much work


Except what you posted will not line up as intended.

Perhaps a slightly different example:

1
2
3
4
[\t][\t]someFunc(  foo,
[\t][\t]           bar,
[\t][\t]           baz
[\t][\t]        );
I really don't care, it's clear enough.
Try to change the name of `someFunc()'
I also dont care about that. Maybe some IDE's will show tabs differently, but when you work in one environment the problem doesn't occur.
When you are working with about 20 peoples, each of whose uses different IDE and prefer different tab size, you have to adhere to some coding style. This is a compromise between 2-spaces tab and 8-spaces tab apologists.
what I tried to say was `I do know that it lines up different from what was requested, but it does line up. And it will line up if you modify the function name'
Topic archived. No new replies allowed.
Pages: 12