CBFalconer wrote:
Frank Heckenbach wrote:
Well, I wouldn't try this. We have enough problems with actual keywords from different standards/dialects (most prominently proably `value' which is a keyword in EP, but is often used as an identifier otherwise).
And if you think noone would ever want to redefine `Integer' ... well, for very strict BP compatiblity we even have to do this (define it as a 16 bit type, though only in the `System' unit with a special conditional) ...
Since 'integer' is pre-defined in the encompassing level 0 block (outside the global declarations) it is perfectly legal to redefine it.
Of course, it is. I was only addressing the question why someone might want to do so.
Thus if you want to ensure your code ports to a 16 bit system you might write:
PROGRAM whatever(...);
CONST maxint = 32767; (* redefine *) minint = -32768; TYPE integer = minint .. maxint; (* redefine *)
...
and away you go! These are NOT reserved words.
To be pedantic, you might want to write `MinInt = -MaxInt;' since the standard demands a symmetric range of Integer.
However, in GPC that's not exactly the same as `Integer (16)'. A subrange would still be a type of the same size as `Integer' (usually 32 bits) which is generally preferable for performance reasons, while strict BP compatibility sometimes requires a 16 bit type because some BP code relies on record layout etc.
Frank