[fpc-pascal] lul.pas does not compile with fpc 2.2.0

Giuliano Colla giuliano.colla at fastwebnet.it
Sun Feb 10 01:33:40 CET 2008


Skybuck Flying ha scritto:
> Doesn't make much sense to me at least.
>
> Who still codes in 16 bit or turbo pascal ?
>
> 64 KB programs ?
>
> Terrible limitations.
>
> I am glad those days are dead/gone/over.
>
If you want Delphi mode, you just put
{$Mode Delphi}
at the beginning of your unit, among the other compiler switches (if any).
If you don't, you get the default fpc mode, which requires a stricter 
syntax.

type TPenis = class // accepted in Delphi mode
is a shortcut for
type TPenis = class(TObject) // required in fpc mode
In both cases TPenis is a descendant of TObject, but in Delphi mode case 
you don't see it.

 From Delphi manual page:
<begin quote>
If the declaration of a class type doesn't specify an ancestor, the 
class inherits directly from TObject. Thus
type TMyClass = class
...
end;
is equivalent to
type TMyClass = class(TObject)
...
end;

The latter form is recommended for readability.
<end quote>

So if you follow Delphi manuals recommendation, you don't see the 
difference, from 16 bits TP to 64 bit  fpc. If you choose not to follow 
them, then you must specify that you want Delphi mode.

Another difference you'll find from fpc mode to Delphi mode is the 
implicit pointer accepted for constructs such as:
MyObjectOnClick := Button1Click; // accepted in Delphi mode
as opposed to:
MyObjectOnClick := @Button1Click; // required in fpc mode

I'd suggest you to read the wiki pages from Mattias reply.

Giuliano




More information about the fpc-pascal mailing list