31
votes
3answers
878 views

Origins of code indentation

I am interested in finding out who introduced code indentation, as well as when and where it was introduced. It seems so critical to code comprehension, but it was not universal. Most Fortran and ...
16
votes
7answers
999 views

Should I write compact code or code with lots of spaces? [duplicate]

I have two friends that have completely different schools of thought on how to lay out their code. The first says that code should be well-indented and use lots of spaces and to name variables ...
10
votes
5answers
1k views

What are the downsides of mixing tabs and spaces? [duplicate]

The advantage of using tabs for indentation is that people can configure their editor to use the tab width they are comfortable with. The only argument against this seems to be that people don't want ...
7
votes
6answers
1k views

Indentation: is there any evidence to show whether 2 or 4 spaces is more readable? [closed]

At the company I work for, we're trying to standardize our development practices, and we want to make the right call regarding indentation. Is there any empirical evidence (preferably research ...
12
votes
5answers
549 views

Reformatting and version control

Code formatting matters. Even indentation matters. And consistency is more important than minor improvements. But projects usually don't have a clear, complete, verifiable and enforced style guide ...
1
vote
4answers
561 views

Indenting labels in C

I noticed that in the Vim automatically indents labels in a rather unintuitive way (IMHO). int main(void) { goto end; end: return 0 } Are there any style guidelines for labels? For the ...
59
votes
11answers
3k views

What are the drawbacks of elastic tabstops?

Look here: a typical holy war on tabs vs spaces. Now look here: elastic tabstops. All problems solved, and a bunch of very useful new behaviours added. Are elastic tabstops even mentioned in that ...
14
votes
2answers
11k views

What is the difference between K&R and One True Brace Style (1TBS) styles?

I have read the Wikipedia article on Indent Styles, but I still don't understand. What is the difference between K&R and 1TBS?
13
votes
8answers
320 views

Styling compound AND / OR if statements

How do you style complex compound AND / OR if statements for maximum readability? How do you indent and where do you place the line breaks? My particular situation is something like the following. ...
4
votes
2answers
399 views

Writing a style guide, what are the best examples for breaking long lines?

You are writing a style guide and you are at the chapter about breaking long lines. What would be the best examples of long lines to demonstrate your rules of breaking long lines. The examples ...