[TUHS] ratfor vibe
will.senn at gmail.com
Sat Feb 5 03:44:09 AEST 2022
On 2/4/22 11:35 AM, Adam Thornton wrote:
> On Thu, Feb 3, 2022 at 11:07 PM Ori Idan <ori at heliconbooks.com> wrote:
> As for EOF it is 0xFF which is not always -1, depending if your
> char is signed or unsigned.
> Ha! You fell into my trap! getc() returns an int! (I don't know if
> EOF is _always_ "all bits set", and even if it is, that's only -1 on a
> twos-complement machine, if we want to head off into some real
> The need to use feof() and ferror() at least appear in the BUGS
> section on my Mac. Linux is not so gracious. The real bug, if you
> ask me, which no one did, is that getc() and pals return an int rather
> than a char, which is surprising and certainly has tripped me up
> several times across the decades (and yes, I understand that since any
> character value is a legal character to have gotten, you need some
> other way of signalling an error).
This is prolly why the authors steadfastly refused to commit to a
particular value for EOF. Instead, they said in essence, that it was a
matter of agreement, convention, if you will, and that whatever value
was chosen, it should NEVER be a legal character. I made it -1, for v7,
cuz it worked... and I wanted so badly to get a working ratfor program
that I sacrificed any semblance of technical rigor to make it copy a
character, onscreen, in real time, live. Heck, and it only took me a
couple of days to figure out all how to get it working, EOF was easy,
STDIN and STDOUT, not so much.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the TUHS