[fpc-devel] Breaking change in FPC 2.6.1

Martin Schreiber mse00000 at gmail.com
Wed Apr 25 06:51:52 CEST 2012


On Tuesday 24 April 2012 23:13:26 Marco van de Voort wrote:
> In our previous episode, Martin Schreiber said:
> > Changing TDataset.Bookmark from TBookmarkStr to TBookmark in fixes_2_6
> > breaks FPC 2.6.0 compatible code. Is this intended?
>
> Yes. It should not break proper code (since that would already treat it as
> abstract type and call freebookmark).
>
I don't understand. This is from FPC 2.6.0:
"
{ TDataSet }

  TBookmark = Pointer;
  TBookmarkStr = string;
[...]
    procedure FreeBookmark(ABookmark: TBookmark); virtual;
    property Bookmark: TBookmarkStr read GetBookmarkStr write SetBookmarkStr;
"
Proper FPC 2.6.0 code treat TDataset.Bookmark as TBookmarkStr, will not call 
TDataSet.FreeBookmark() because the parameter does not match and will not use 
an additional try finally block because there is an implicit try finally to 
finalize the variables with automatic memory management by the compiler 
already.

> > TBookmark is defined as "Pointer" which has no automatic memory
> > management so probably TDataset.FreeBookmark() must be called in a try
> > finally block for every assignment of TDataset.Bookmark to a variable.
> > As intended too?
>
> I first changed it to tbytes (as it is in D2009+), but got some comments
> that that was very incompatible, and a lot of method signatures would
> change. So I kept it pchar. (planning to change it to tbytes in trunk
> eventually)
>
Please change TDataset.Bookmark to tbytes = array of byte if you absolutely 
need to change it in fixes_2_6 so we have a bookmark type with automatic 
memory management again.

> Freebookmark should have been called already, afaik it is at least
> since D2006, if not easier, and FPC also implements it quite a while.
>
Marco, please, in my opinion the purpose of Free Pascal should be to provide a 
handy, versatile and user friendly tool which can be used from pupils to 
professionals. I know that there is a need to have a Delphi second source 
compiler in case Embarcadero drops it but there are other requirements too. I 
am really angry now.

Martin



More information about the fpc-devel mailing list