- Location
- West of the Severn UK
- Info
@Alistair Ward@Martin Wynne @Steve_Cornford
Hi,
I just created a PR to fix a potentially serious bug that I spotted. I have replaced the marks_list_ptr with a dynamic array of Tmark records.
This removes the Pointer <==> Integer typecasts, that would have been fine with Delphi 5, but will potentially fail miserably with Lazarus on Win64 as Pointers are 64-bit, and integers are only 32-bit.
On a separate note, I would like to continue in this area and remove all the intarray functions, and replace with dynamic arrays, and possibly replace the array of arrays (background marks) with a single array of records.
Alistair.
Hi Alistair,
Thanks for doing that. Does it still need a lot of testing?
I've been aware of the problem for a long time, but the intarray system has been working fine for over 25 years, and at present we are creating a Win32 program, not Win64. I never considered changing until now because Win64 does not support the 80-bit extended type. For this reason the helper executables for PDF creation and file conversion will have to remain as Win32 even if Templot5 goes to Win64 or other platforms. Likewise the sketchboard and TRichView if they also get done as helper executables from Delphi5.
I created the intarray system back in Delphi2 days because Delphi2 did not support dynamic arrays. I could have changed when I upgraded to Delphi5, but intarray was working fine and I always prefer "if it ain't broke don't fix it", when there is always so much else to be done.
Dynamic arrays are not always easy to use because you can't simply assign one to another. You have to use the Copy functions. I think Borland (as it then was) created the dynamic arrays in response to user demand as a sort of kludge on the existing string functions and I never really trusted them. Presumably in Lazarus they have been implemented in their own right and are fully reliable.
Thanks for the PR. I will have a look and see what to do, if you think now is the time to make the change. So far the priority has been simply to get Templot fully working in Lazarus before we start making wholesale changes. I'm reluctant to spend much time making changes which make no detectable functional difference for users, when there is so much else that they are waiting for.
cheers,
Martin.
message ref: 13848