sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Tue Sep 04, 2007 4:32 pm Post subject: Another problem with the OPEN statement |
|
|
Quite coincidentally, I have been having fun of a different kind with the OPEN statement today. When I finally realised what I was doing wrong, it prompted the question whether or not I should reasonably expect the compiler to catch the error in question.
I had confused two specifiers in the OPEN statement. I had a statement that read (in part):
OPEN (....., status = 'append', ...)
rather than the intended:
OPEN (....., status = 'old', position = 'append', ...)
The outcome that every time the statement was executed, the existing file contents were wiped and replaced with the payload of the next WRITE statement - exactly the reverse of the intended outcome.
Metcalf & Reid says, apropos of all the various character-type specifiers, that they must provide one of a specific list of values. It is silent (as far as I can see) on what should happen if an unrecognised value is provided for a specifier. What appears to be happening is that the default value is used if the value supplied is not one of the permissible ones. What I incline to think should happen is that a run-time error message should be issued.
What do others think? What does the standard say?
Actually, now I come to write this down, it is ringing vague bells of a I've-asked-something-on-these-lines-this-before nature. Sorry if so.
Andy |
|