Coding: Other Whitespace

For the sake of readability, do not squish out commonly used optional whitespace, unless retaining the space would violate some other major rule, such as keeping the lines fully on the screen. The old reasoning about disk space being precious has been crushed by plummeting disk prices over the past few decades. Such spaces include:

At a previous employer, standard practice was to leave a space after the opening paren of a function's (actual) argument list. The reasoning is that this means there is a space before each argument. Why this is good, I am not sure, but since it means more whitespace rather than less, okay. On the other claw, they omit the space before the opening paren! Again, why, I have no clue, but this time I dislike it -- but did of course obey....

In C, do NOT insert extra spaces between the & or * and an object, when taking its address or using it as a pointer -- in these cases, it could be confused with bitwise "and", or multiplication. Likewise, do not add whitespace to ->, and in Pascal, do not add whitespace to ^, nor to . in either.

There should be no more than one consecutive blank line within a function, except maybe to separate the initial variable declarations from the rest. (This obviously applies more to languages where they are not already well separated, such as C, than where they are, such as Pascal.) If you feel there needs to be more of a separation, use a comment. Functions should be well separated; see Comments, but if you don't use function headers, use at least one more consecutive blank line than you use within functions.

If you intersperse comments with your code, leave a blank line before each comment.

There are many other places where some programmers put a space and others do not, such as:

These are up to the programmer, and needn't even be very consistent, since they do not affect readability much. They may be taken out in order to make a line fit within 79 columns.