[fpc-pascal] inline and other modifiers

noreply at z505.com noreply at z505.com
Thu Dec 22 02:27:33 CET 2011


>
> On 17 Dec 2011, at 11:29, Bernd wrote:
>
>> But I am still surprised that inline can be declared in either of the
>> two sections ( I am not complaining, I am actually glad it works for
>> my particular application). Is there any recommended style, is it bad
>> practice to put it into the implementation?
>
> Keeping the interface and implementation declarations the same is the best
> approach. Inline currently always changes the definition anyway (as far as
> the compiler is concerned) because the implementation becomes part of the
> definition once it's parsed. In the future, this may however change to
> prevent unexpected recompilations
> (http://bugs.freepascal.org/view.php?id=19673 ).
>
>
> Jonas


Another thing freepascal allows is for OVERLOAD to be declared one place
but not the other. Delphi is more strict in this regard.  Also delphi is
more strict when it comes to PROGRAM name parsing. In freepascal the
program name can mismatch the file name, whereas delphi stops compiling
and tells you error.

In other cases, freepascal is more strict than delphi.  I think Wirth
would prefer pascal to be as strict as possible, but sometimes being so
strict makes the language less convenient. I don't know. Another thing I
noticed is you can just use a begin and end for freepascal without PROGRAM
declaration at the top of the program.. again less strict than delphi. In
the freepascal unit tests I think they are all just begin/end programs
without the program declaration at the top of each file. Possibly more
convenient for developers. Wirth would complain and say that's not strict
enough. I personally don't know what the best route to choose is.
Sometimes convenience is better. Other times I would like to stick to
strict.



More information about the fpc-pascal mailing list