On 10/25/06, Matthew Winn <[EMAIL PROTECTED]> wrote:
On Tue, 24 Oct 2006 19:35:41 +0200, "A.J.Mechelynck"
<[EMAIL PROTECTED]> wrote:

> In Algol, Pascal, and (IIUC) C, the semicolon is a "statement separator". The
> last statement before an *end* or } doesn't need an ending semicolon; if there
> is one, then there is an "empty statement" after it.
>
> In COBOL, OTOH, every sentence (or label or data declaration or...) must end
> in a period followed by a space. Even the last sentence in the last paragraph
> in the last section (if any) in the program's PROCEDURE DIVISION must have
> one. The period followed by a space is not a "separator", it's a "terminator".
>
> Apparently the Windows engineers came from Algol, Pascal and C while the Unix
> people came from COBOL. Or did they?  :-รพ

I think it's more likely that the Windows engineers came from some
lazy language. I won't name one for fear of making enemies.

The "newline as separator" idea feels like a hack for a lazy coder. If
you load your entire file into memory and then just skip through it
looking for newlines, replacing them with nulls and using the address
of the next character as the start of a line, then hey presto: you
have a nice, tidy array of lines. Except you have one extra line of
zero length at the end. Oops. Instead of adding special code to ignore
that one line, why not just leave out the final line terminator when
writing the file so it won't cause a problem when reading it back? Far
easier, and it saves you a few minutes coding time. Of course it does
mean that everyone else has to cope with the fact that one line has no
terminator and all the others do, but it's _their_ time that's wasted,
not yours, so it doesn't matter.

And so a Windows convention is born...

Well, in unix, you do:  printf(".......\n",.....); so you
always have \n at end of file. Apparently windows programmers
do something completely different. Maybe they do
printf("\r\n......", ....); maybe something even more weird.

Yakov

Reply via email to