I just checked that Free Pascal accepts the followig program:
program keyw; var absolute, external, overload, override, virtual, abstract, reintroduce : integer; begin end .
gpc -fdelphi says:
keyw.p:2: error: `absolute' is a keyword in Borland Pascal keyw.p:2: error: `external' is a keyword in UCSD Pascal, Borland Pascal, keyw.p:2: error: traditional Macintosh Pascal keyw.p:2: error: `virtual' is a keyword in Object Pascal, Borland Pascal, keyw.p:2: error: traditional Macintosh Pascal
It seems that all of them as treated as "directives" and hence may work also as variable names.
Could some kind soul check how other compilers behave -- if the names are really directives then we should teach gpc to accept them as variable names in those dialects.
program keyw; var absolute, external, overload, override, virtual, abstract, reintroduce : integer; begin end .
gpc -fdelphi says:
keyw.p:2: error: `absolute' is a keyword in Borland Pascal keyw.p:2: error: `external' is a keyword in UCSD Pascal, Borland Pascal, keyw.p:2: error: traditional Macintosh Pascal keyw.p:2: error: `virtual' is a keyword in Object Pascal, Borland Pascal, keyw.p:2: error: traditional Macintosh Pascal
It seems that all of them as treated as "directives" and hence may work also as variable names.
Could some kind soul check how other compilers behave -- if the names are really directives then we should teach gpc to accept them as variable names in those dialects.
MWPascal accepts the program without errors or warnings.
UCSD Pascal (for the Apple II) rejects "external" (error 2, Identifier expected) but accepts the rest.
Regards,
Adriaan van Os
On 24 Oct 2005 at 5:59, Waldek Hebisch wrote:
I just checked that Free Pascal accepts the followig program:
program keyw; var absolute, external, overload, override, virtual, abstract, reintroduce : integer; begin end .
gpc -fdelphi says:
keyw.p:2: error: `absolute' is a keyword in Borland Pascal keyw.p:2: error: `external' is a keyword in UCSD Pascal, Borland Pascal, keyw.p:2: error: traditional Macintosh Pascal keyw.p:2: error: `virtual' is a keyword in Object Pascal, Borland Pascal, keyw.p:2: error: traditional Macintosh Pascal
It seems that all of them as treated as "directives" and hence may work also as variable names.
Could some kind soul check how other compilers behave -- if the names are really directives then we should teach gpc to accept them as variable names in those dialects.
Delphi compiles it, but with these "hints": Hint: Variable 'absolute' is declared but never used in 'keyw' Hint: Variable 'external' is declared but never used in 'keyw' Hint: Variable 'overload' is declared but never used in 'keyw' Hint: Variable 'override' is declared but never used in 'keyw' Hint: Variable 'virtual' is declared but never used in 'keyw' Hint: Variable 'abstract' is declared but never used in 'keyw' Hint: Variable 'reintroduce' is declared but never used in 'keyw'
BTW, FPC gives the same hints (called "Note") as Delphi.
BP accepts it without any complaint.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
program keyw; var absolute, external, overload, override, virtual, abstract, reintroduce : integer; begin end .
gpc -fdelphi says:
keyw.p:2: error: `absolute' is a keyword in Borland Pascal keyw.p:2: error: `external' is a keyword in UCSD Pascal, Borland Pascal, keyw.p:2: error: traditional Macintosh Pascal keyw.p:2: error: `virtual' is a keyword in Object Pascal, Borland Pascal, keyw.p:2: error: traditional Macintosh Pascal
It seems that all of them as treated as "directives" and hence may work also as variable names.
Could some kind soul check how other compilers behave -- if the names are really directives then we should teach gpc to accept them as variable names in those dialects.
MWPascal accepts the program without errors or warnings.
UCSD Pascal (for the Apple II) rejects "external" (error 2, Identifier expected) but accepts the rest.
Follow up - Table 3 of the (Apple) UCSD Pascal Language Reference Manual lists EXTERNAL as a reserved word (as opposed to Table 4 that lists predefined identifiers). Appendix A of the UCSD Pascal book "Pascal for the IBM Personal Computer" lists EXTERNAL also as a reserved word.
Regards,
Adriaan van Os