Why does READ-FILE and READ-LINE return values not the same? #160
Replies: 1 comment 1 reply
-
|
As specified in the standard, it is there to ensure that we can tell the difference between end-of-file and a zero length line. A single return value is not sufficient, as is explained in the annex A; https://forth-standard.org/standard/rationale#rat:file:READ-LINE.
READ-FILE does not require it since there is no concept of a lines, just a requested and returned length.
From: Anthony Howe ***@***.***>
Sent: Thursday, August 8, 2024 3:33 PM
To: ForthHub/discussion ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [ForthHub/discussion] Why does READ-FILE and READ-LINE return values not the same? (Discussion #160)
READ-FILE ( caddr u1 fid -- u2 ior ) while READ-LINE ( caddr u1 fid -- u2 flag ior ) has an extra redundant flag. Surely in the case of READ-LINE ior == 0 is sufficient to indicate success as is done else where; the extra flag return value seems pointless.
—
Reply to this email directly, view it on GitHub <#160> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAOB6OWHUPENHMCX44C6OALZQN6SZAVCNFSM6AAAAABMGUBVBOVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGAZDMMRRGM> .
You are receiving this because you are subscribed to this thread. <https://github.com/notifications/beacon/AAOB6OQ7QJROZF7IMTMRKJLZQN6SZA5CNFSM6AAAAABMGUBVBOWGG33NNVSW45C7OR4XAZNKIRUXGY3VONZWS33OVJRW63LNMVXHIX3JMTHAA2ZWEU.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
SirWumpus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
READ-FILE ( caddr u1 fid -- u2 ior )whileREAD-LINE ( caddr u1 fid -- u2 flag ior )has an extra redundantflag. Surely in the case ofREAD-LINEior == 0is sufficient to indicate success as is done else where; the extraflagreturn value seems pointless.Beta Was this translation helpful? Give feedback.
All reactions