(I was out of town for some weeks, still catching up with the mails ...)
Waldek Hebisch wrote:
To be more precise: "{$enable-keyword asm}" just causes `asm' to be recognized as the keyword. Other checks are unaffected by "enable-keyword". Apparently, for `pow' no more checks is used,
Yes. As a (rough) rule of thumb from a user's point of view, things that could be implemented in (some dialect of) Pascal, except for their built-in identifier/keyword status, require no more checks, since they are actually implemented just this way internally. This includes "pow" (an operator as can be defined and overloaded according to OOE extensions that GPC supports) and of course all types such as "Cardinal".
Whereas most built-in routines are a bit different (often only in that they allow different parameter types, even if only, say, LongInt for maximum range and Integer for better performance when sufficient; so when GPC will allow overloaded routines, this may then apply to some built-in ones as well).
I am tempted to say that the exact effect of enabling a keyword which otherwise would be disabled by dialect settings is explicitly undocumented.
I agree.
There are two alternate ways I can accomplish this:
- Choose the GP dialect and either program around the semantic changes ("if s = 'GPC ' then") or use compiler directives to restore EP semantics ("{$no-exact-compare-strings}").
If you need this for a lot of source code, I'd probably recommend this. The lists of required options shouldn't be that long if you only want to avoid incompatible behaviour, and not exclude all unneeded extensions, as we try to not be incompatible to EP in GPC dialect unless EP's behaviour is ... well ... too strange (talk about string padding ;-).
- Choose the EP dialect and bracket each extension with "{$gnu-pascal}" and "{$extended-pascal}".
But if I could choose EP and selectively enable the extensions, it would be simpler, and it would document at the start of the source file exactly what extensions were used.
OTOH, if you need the extensions only for some routines (or can be encapsulated in a few), I'd probably go for that. Even if these routines are used in many programs later, you could put them in a module, and compile this module only (or even parts of it) with "{$gnu-pascal}".
Frank