On Wed, Aug 13, 2003 at 05:33:20AM +0200, Frank Heckenbach wrote:
CBFalconer wrote:
PROGRAM countem;
VAR f : FILE OF CHAR;
[...]
Let me point out that your results are entirely dependant on how the OS and run-time handles line ending sequences. Remember that the default mode for files is text,
Who says so? At least in GPC, that's the default only for textfiles.
and thus such translations would be enabled. For valid results you have to treat the file as binary, and you are then running into system variations. Probably the most portable method is basically:
TYPE byte = char; binfile = FILE OF byte;
How is this any more "binary" than `file of Char'?
Also you should realize that, in Pascal, there is no reason for any end-of-line char or sequence to exist.
That's true. -- But he only claimed portability to any GPC target, not any Pascal system. It's probably impossible to do this in pure standard (including Extended) Pascal. (But I'm ready to see examples to the contrary, especially from those who claim that standard/Extended Pascal is wholly suitable for real world programs ...)
Actually, if I read the standard correctly, the `Char' type doesn't need to contain anything but the digits.
And '''', per 6.1.9. Moreover, IIUIC, 6.10.* implicitly require that Char contains ' ', '-', '+', '.', and the letters 'a', 'e', 'f', 'l', 'r', 's', 't', 'u' in an implementation-defined case. Anyway, I seriously doubt that 6.4.2.2 d) was intented as "no letters at all is fine", it might be a bug in the standard.
Emil