Subj : Re: Dartmouth BASIC to C To : comp.programming From : spinoza1111 Date : Sat Aug 13 2005 04:22 am John Smith wrote: > spinoza1111@yahoo.com wrote: > > Looks great, with a minor cavil. > > > > You simulate Dartmouth Basic's READ/DATA facility which would give a > > system error message if there was not enough DATA to READ in the pool > > of DATA. > > From page 6 of the manual: > > "After commpleting the computation for the second set of right hand > sides and printing the answers, the computer will give the last values, > 4 and -7, to the variable B1 and B2, compute and print the third set of > answers, and then stop, because there is no more data when the READ > statement 30 is encountered for the fourth time." > > and page 27: > > "Each time a READ statement is encountered anywhere in the program, the > data block supplies the next available number or numbers. If the data > block runs out of data, with a READ statement still asking for more, the > program is assumed to be done." > > My understanding of this is that the result of a READ after data are > exhausted is normal termination, not an error. I don't remember whether > this was the case with later flavors of BASIC, for example, the MS > Basics. I'll have to trot out my copy of qBasic and give it a try. Hmm, the compiler in my book (Build Your Own .Net Language and Compiler) produces an error message. You'll have to explain to me how you can terminate "normally" when a READ DATA statement is executed, for example inside a For loop. If no error message is provided, this isn't normal termination. Instead, it's partial output and an unexplained termination. However, this is better than the C program which will, I think, read values from random memory locations. > > JS .