[fpc-pascal] TP compatibility: procedural type
Karoly Balogh (Charlie/SGR)
charlie at scenergy.dfmk.hu
Tue Aug 29 14:54:29 CEST 2017
Hi,
On Tue, 29 Aug 2017, Anton Shepelev wrote:
> Ignoring them in the sense of not affecting the gen-
> erated machine code is perfectly OK, but not requir-
> ing their presence in the source, to make the pro-
> gram compilable in Turbo Pascal, seems wrong when
> Free Pascal is in Turbo Pascal mode. A program that
> Free Pascal compiles successfully in TP mode should
> work with the actual Turbo Pascal compiler. Is it
> not the purpose of these modes? Do they guarranty
> only forward-compatibility?
Yes. We won't stop you allocating more than 64K RAM with GetMem() in one
go, or restrict how much stack you use, how big is your code, how long
your source lines are for example, which are also all TP incompatible. The
size of the real type is also incompatible, you can still use ansistrings
and a bunch of managed types, or 64bit integers, in fact you can even do
that on i8086 with Free Pascal. To use Port[] you need to add unit Ports
to your uses clause, even in TP mode. I could go on and on... So no, our
TP mode was never designed with the promise that whatever you write in it
will be compilable by TP, but we try to be as close as reasonably
possible, without compromising our compiler integrity. And for that,
ignoring far/near was perfectly fine.
> >Although this documentation should probably be up-
> >dated, because we now support some 16bit and 8bit
> >systems as well.
>
> There is more to correct, e.g.:
>
> In Free Pascal, you need to use the address @ opera-
> tor when assigning procedural variables.
>
> This is not true of TP mode.
Yes, the use of @ operator is compiler mode specific. This is actually
documented here (at the @ operator page):
https://www.freepascal.org/docs-html/3.0.2/ref/refse83.html
> >But I'm pretty sure you can find a bunch of other
> >things, which FPC allows even in TP mode, but TP
> >disallows/doesn't support, just because the amount
> >of extra features in the language since TP was
> >out...
>
> I think such features should be available in Delphi
> and FPC modes, but not in TP, which should implement
> and enforce Pascal in exactly the way it was sup-
> ported in the historical Turbo Pascal compiler.
As I said, we won't enforce all the limits with TP enforces on you, simply
because we can't, and we don't want either, and it's not the purpose of
Free Pascal.
Anyway, if you still think this needs to be fixed in TP mode, feel free to
come up with a patch, and open a bugtracker entry about it. But it's
highly unlikely we'll ever try to enforce all TP limits, especially ones
which don't make sense on modern processors.
Charlie
More information about the fpc-pascal
mailing list