[fpc-pascal] Some RTL functions cry big tears when mixing Pchar and Ansistring/String

md at rpzdesign.com md at rpzdesign.com
Tue Jun 11 15:10:58 CEST 2013


To Marco and Jeppe:

As for 2 examples:

res := PosEx(mypchar,'NEEDLE',35) ;

res := Copy (mypchar, 10,15) ;

What are the byte boundaries here?
Zero Based from the pointer?
1 Based from the pointer?

As far as behavior, it would throw the program in unstable land over 
time and gdb
would show worthless garbage on Backtrace with a stack that was totally 
upside down.

When I stumbled across these calls and cleaned them up to keep pchar and 
ansistring operations
clearly separate, magically, stability returned to my program.

The reason I posted this to the list is that it is my responsibility to 
the community to raise
the chatter, even though I cannot right now produce a working sample to 
reproduce the bug.

I absolutely love the combination of Lazarus 1.08/FPC 2.6.2. Awesome, 
awesome, awesome.
My productivity just went up 10x.

And we get Mac OSX targets, IOS targets, and Android NDK targets!

Cheers,

md






jeppe at j-software.dk

Could you maybe describe this weird, erratic behavior?

On 6/11/2013 12:58 AM, Marco van de Voort wrote:
> In our previous episode, md at rpzdesign.com said:
>> Passing a Pchar gives weird, erratic behavior
> Please make minimal examples in a few lines, and add them to the bugtracker.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>




More information about the fpc-pascal mailing list