On 18 Oct 2001, at 1:08, Frank Heckenbach wrote:
Is this allowed...
I don't believe that you will find anything in the standard that mandates that variables be mapped specifically to memory locations and not, e.g., to I/O devices. Such a mapping surely is the function of the external environment and therefore won't appear in the standard.
My point simply is that there may be mechanisms for a conforming program without program parameters to affect the external environment. Assuming that a syntactically correct Pascal program cannot have any useful effect and therefore should be rejected by GPC is unwarranted.
...(since it might change the meaning of the program)?
ISO 7185, section 5.2, "Compliance, Programs" says, in part:
"The requirements for conforming programs and compliant processors do not require that the results produced by a conforming program are always the same when processed by a compliant processor."
(...though this is a note and therefore not normative.)
Shouldn't such variables be also mentioned in the program parameter list? I think so ...
Such variables may be mentioned in the program-parameter-list, but I disagree that the standard requires that they be mentioned there.
ISO 7185, 6.10 says: "The binding of the variables denoted by the program-parameters....
This describes the requirements for any such variables mentioned in the program-parameter-list but does not say that any variable that might be bound to an external entity by the environment *must* be mentioned there (i.e., this section defines one such binding method but does not prohibit other, unspecified methods that might be present in the external environment).
...I conclude that GPC is ok in not supporting anything but files in the program parameter list...
I agree.
...but I also gather that such variables that you talk about should be mentioned there...
I disagree, unless the standard has some explicit restriction on how such variables are allocated to physical storage by the external environment (I couldn't find such a restriction).
So it still seems to me that a meaningful ISO-7185 program cannot have an empty parameter list.
Perhaps we're arguing to no purpose here. Do you agree that GPC should not reject a syntactically legal program that doesn't specify a program- parameter-list? If so, then my argument is irrelevant to this point.
Maybe a borderline-case of "meaningful". (Providing a compiler feature that only exists to be tested seems quite strange to me. ;-)
Then the whole GNU "autoconf" mechanism must seem strange to you! ;-)
As another example, the GPC test suite should test to ensure that legal Pascal programs are processed correctly, but also that illegal Pascal programs are caught and reported, yes? In that case, a test program such as:
program casetest;
var mixedcase, MixedCase : integer;
begin end.
exists to ensure that the Pascal compiler is case-insensitive (a syntax error is expected) and therefore would be meaningful without any program parameters. Requiring this program to have "(output)" in the program header would be pointless.
(By the way, gpc-20010924 does *not* catch this error!)
However, it's not clear to me that it's always intentional -- the programmer might just have forgotten to provide the parameters.
True.
But since this will result in errors further down (unless he also forgot any I/O in his code ;-), that's alright I think ...
Right!
-- Dave