Boolean functions



However! In the very difficult to read part of it specifies that eoln()s shall be forced to exist in a text
file if they don't exist, ie., if the true end of the file is encountered, then an eoln() shall effectively be inserted
before the file end. This is not inconsistent with, because eof() will not be true even though the true end
of the file has been reached. Therefore, eof() and eoln() will not both be true at the same time.

The standard behavior was designed to allow you to create loops to check eoln() only, then check eof() afterwards.

program x(input);


   if not eof then begin while not eoln do begin ... end; readln end


is valid because if the file is completely empty, then it must have a series of complete lines (even if the compiler
has to simulate inserting them).

-------- Original Message --------
Subject: Re: More issues with EOLN, EOF, and the Pascal standard.
From: Waldek Hebisch <>
Date: Thu, September 24, 2009 11:59 am

Chad Simmons wrote:
> In a continuation of the thread:
> Regarding conformance to the ISO 7185. It seems that GPC will correctly report EOLN before EOF even when none exists in the file. However, after successfully reading the end of line character, EOLN will still return true while EOF also simultaneously returns true.
> This has a tendency to give odd results. EOF and EOLN should be mutually exclusive. If the file doesn't properly have it's end of line marker before the end of the file, GPC can, should, and does currently insert the end of line into the buffer. But once it's been read, EOF should return true, and EOLN should not.

Why do you think so? Concerning conformance, the standard says
that calling EOLN when EOF is true is an error. In other words
conformat program befor calling EOLN should check that EOF is false.
And GPC compiled program is free to do anything if you call EOLN when
EOF is true: it can return true, it can return false, it can singal
error, it can simply crash.

So the question is what is most convenient. Returning true means
to the idiom 'not(eoln)' has clear meaning: there is something to
read. While one can probably give good justification to returning
false, changing behaviour now would almost surely break some
real programs, so change would be not wise.

Waldek Hebisch