How do you escape a reserved word in Free-Pascal?
Actually i'am working on translate some librarys to free-pascal. so the problem is which in delphi can use the ampersand (&) symbol to escape a reserved word, but in free-开发者_如何学编程pascal does not work. the compiler complains with this message
ForLibDx.pas(72,13) Fatal: illegal character "'&'" ($26)
when include an ampersand symbol.
actually i am using the {$MODE DELPHI}
to compile my units under free-pascal
FPC 2.2.4
Lazarus 0.9.28.2
thanks in advance.
From what I recollect, the FPC compiler does not have a means for escaping reserved words.
The ampersand (&) as an escape character to escape reserved words is a Delphi-compiler-only feature of the Delphi language.
You might work around this by using the fully qualified name (including unit, and classname) as Rob Kennedy suggests here.
NB: It is recommended to avoid these ampersand escapes in Delphi for non-generated code, as not all of the IDE and 3rd party tools can cope with it.
--jeroen
精彩评论