> -----Message d'origine----- > De : fpc-devel-boun...@lists.freepascal.org > [mailto:fpc-devel-boun...@lists.freepascal.org] De la part de > Marco van de Voort > Envoyé : mardi 24 avril 2012 23:13 > À : FPC developers' list > Objet : Re: [fpc-devel] Breaking change in FPC 2.6.1 > > > 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). >
It broke also lazarus, MDO, rxmemds. > > 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) > If it were pchar we wouldn't have the problems since pchar and string are assignment compatible. It is pointer now. Don't know where the comments came from but here we are in a situation where most 3rd party datasets had to be adapted to the change to pointer and will have to change again to tbytes later on. On top of that the freebookmark that a lot of third code had to add to catch up to the change to pointer isn't needed anymore for tbytes as it is a managed type. Why not bite the bullet immediately and just skip pointer? Avoiding incompatibility clearly failed. On the Delphi forums, similar discussions have been going on: people complaining about the different Tbookmark implementations and having to change their code. Wish we could have learned from that. > Freebookmark should have been called already, afaik it is at > least since D2006, if not easier, and FPC also implements it > quite a while. > http://docwiki.embarcadero.com/Libraries/en/Data.DB.TDataSet.FreeBookmark Quote: "TBookmark is an alias of TBytes. This means that TBookmark is automatically garbage collected when it goes out of scope. Because TBookmark does not need to free memory, the FreeBookmark method is blank for the default implementation." Ludo _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel