C
Chris Croughton
EOL processing can be made fairly painless. An EOL (carriage return) is
EOL is not necessarily "carriage return" (I believe some Macs use it,
nothing I've ever used). EOL is anything the implementation wants
external to the C program (including no character at all if lines are
counted strings) and is represented by the character '\n', 'newline', in
C.
quite different from a mere space and it would be a shame for the compiler
to completely ignore this extra *information* in a source file.
Would it like to use the spaces for indentation as well? I know at least
one language which does -- and just like using EOL it's a pain more
often than it is useful.
For example EOL can be ignored when following a symbol that is *expected* to
be followed by something else, such as "+". And converted to ";" (or acts as
statement terminator) otherwise. Use "\" to override this behaviour in the
latter case and ";" in the former, if it should ever be necessary.
Awk and Python are in other newsgroups.
Some conventions need to be used, for example it is necessary, if splitting
'a+b', to write:
a+
b
rather than:
a
+ b
As it happens, that's how I usually break lines anyway by choice.
However, there are millions of lines of code which use the opposite
convention according to local coding standards (I've had to write many
thousands of them) which would be broken by such a change.
In practice multiple EOLs (blank lines) must be treated as one and the
compiler should be tolerant of consecutive ";"s. The biggest problem (I will
mention it before anyone else) is sending source code over networks that
wrap lines at arbitrary points.
Anything which wraps lines, like editors and "beautifiers", is likely to
break it.
A bigger problem is that it is not obvious visually without doing a
parse whether a statement is finished or not. In your second example it
is perfectly obvious visually that what is meant is a + b, but your
compilers will take it as two statements, a and +b (presumably without
giving a warning, since both would be valid statements).
If you want a different language, use it. Having a semicolon which
terminates statements (as opposed to separating them as in Pascal) is
something with which most C programmers have no problem.
Chris C