[fpc-devel] hacking strings/dyn array...

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 7 14:34:45 CET 2012

On 06 Dec 2012, at 22:45, Martin wrote:

> I am currently fixing some of the PascalScript issues. When working  
> with strings, it sometimes needs to inc/dec the refcount (or access  
> the length)
> Current code does calculate the position of that data as either 1 or  
> 2 times sizeof(Pointer) in front of the actual data. (Not guaranteed  
> for the future, but currently it is there)

Not in svn trunk.

> Then it accesses the refcount/length using a 32bit type.
> This raises 2 questions:
> - 1 does on a 64bit target the length/ref count ever exceed the  
> 32bit range?

That depends on the program. The RTL definitely can deal with such  

I think a standard RTL unit to provide such functionality would be  
better than all this hacking. I'm not sure whether the best approach  
would be to reuse the include files from the system unit (so there is  
no duplicate maintenance), or to create a separate unit with a  
different interface so that the system unit/compiler interface can  
continue to evolve independently without breaking the external  
interface for programs using that unit (but that would require  
exhaustive tests for every single routine in that unit in order to  
prevent bit rot).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20121207/10eeb83c/attachment.html>

More information about the fpc-devel mailing list