Bug in 4.2 BSD Pascal implementation ???

Russell Shilling russell at muddcs.UUCP
Sat Sep 1 10:15:24 AEST 1984


[eat this, Sucker !!!]

	Recently I've been trying to write introductory manuals for some
of the languages we have available, and in the process of converting a
Modula-2 program to Pascal I found an (apparent) error in the definition
of the Pascal language (we have 4.2 BSD.)
	It seems that the "read" statement will allow reading past the end
of the current line and on to the next.  Isn't this wrong, (at least as
far as the way the read was supposed to work) ???
	As an example, the following code will not operate correctly
(as I understand the idea of correctness):

program ReadTest(input,output);
  var C: char;
  begin
    repeat
      while not eoln do begin	(* should echo one line of chars *)
        read(C);   write(C);
      end;
      readln(C);	(* supposed to be required to read past *)
      writeln;		(* end-of-line marker, right ???        *)
    until eof;
  end.
  
	This program seems to work fine when you are reading from the 
standard input, but if you redirect input from a file, every other line
is skipped.  Perhaps I'm full of blue mud, but I thought that you could
"read" forever without reading past the end of line.  Can someone explain
either where my misconception of the language definition is, or maybe
verify that this is a legitimate bug ?


-- 

	Russell Shilling

	{ allegra, ihnp4, seismo }!scgvaxd!muddcs!russell
	=====  plplplplplplplplplplplplplplplplplp  =====



More information about the Net.bugs mailing list