Chad Simmons wrote:
In a continuation of the thread:
http://www.gnu-pascal.de/crystal/gpc/en/raw-mail10017.html
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.