Porting Turbo Pascal applications
This document contains some informations about differences between FPK-Pascal
and Turbo Pascal 7.0.
This list is not complete.
Assembler
-
The assembler uses an other syntax.
-
The 32 bit memory model requires a complete recoding of your assembler
sources
Run time library
-
Unit SYSTEM
MEM, MEMW and PORT are not supported, use the functions
of the unit GO32 instead.
VAL expects as third parameter always a WORD
-
The unit OVERLAY isn't available
-
Turbo Vision is not available
Preprocessor
-
nested comments are allowed
Syntax
-
FAR and NEAR are ignored
-
To get the address of a procedure to assign it to a procedure variable
the @-operator must be used.
-
PACKED, INLINE and ABSOLUTE are not supported
by the compiler, but they are keywords
-
The header of forward declared functions must be always complete rewritten
in the definition, else the compiler improves that the procedure are overloaded
or you must use the switch -So
-
There some more reserved words
-
some Delphi extensions are partial supported
-
typed files aren't supported
Semantics
-
always short boolean evalution
-
function results could also be complex types like arrays or records
-
it's possible to handle the function result in a function like a variable:
function a : longint;
begin
a:=12;
while a>4 do
begin
{...}
end;
end;
-
the example above would work with TP, but the compiler would assume that
the a>12 is a recursive call. To do a recursive call in this you
must append () behind the function name:
function a : longint;
begin
a:=12;
{ v---- this is a recursive call }
if a()>4 then
begin
{...}
end;
end;
the exit procedure could also used with a parameter which is the function
result:
function a : longint;
begin
a:=12;
if a>4 then
begin
exit(a*67);
end;
end;
forward defined functions must be always defined with the full header or
use the switch -So
procedure x(v : longint);forward;
procedure x; { this overloads the procedure x !!!!}
begin
....
end;
{ write instead: }
procedure x(v : longint);
begin
{...}
end;
Others
-
The command line parameters are different
-
compiler switches are different
-
the units aren't binary compatible
klaempfl@haegar.cip.mw.uni-muenchen.de
Copyright (c) 1996,97 by Florian Klaempfl