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

2013-06-11 Thread Jeppe Græsdal Johansen
Den 11-06-2013 04:49, m...@rpzdesign.com skrev: Passing a Pchar gives weird, erratic behavior Could you maybe describe this weird, erratic behavior? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

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

2013-06-11 Thread Marco van de Voort
In our previous episode, m...@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@lists.freepascal.org

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

2013-06-11 Thread m...@rpzdesign.com
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

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

2013-06-11 Thread Marco van de Voort
In our previous episode, m...@rpzdesign.com said: As for 2 examples: res := PosEx(mypchar,'NEEDLE',35) ; res := Copy (mypchar, 10,15) ; These are not examples. These are snippets. Examples I can compile and debug. What are the byte boundaries here? Zero Based from the pointer? I

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

2013-06-11 Thread m...@rpzdesign.com
Oops, those parameters for Posex were backwards: res := PosEx('NEEDLE',mypchar,35) ; On 6/11/2013 7:10 AM, m...@rpzdesign.com wrote: 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

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

2013-06-11 Thread Antonio Fortuny
Hi Folks. I don't know how Jeppe is playing around but because I want to make sure FPC works preoperly I decided to take some time to see what happens Yhis is the code snippet I use in Win32 and Linux x86_64 All are Lazaur 1.0.8 Put the code under a

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

2013-06-11 Thread Felipe Monteiro de Carvalho
On Tue, Jun 11, 2013 at 5:29 PM, m...@rpzdesign.com m...@rpzdesign.com wrote: I totally understand, but I did not discover the problem until I was well into a larger project that I could not de-construct to try to generate a reproducible sample. I am under a time pressure, decided to start

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

2013-06-10 Thread m...@rpzdesign.com
Under Linux using Lazarus 1.0.8/Fpc 2.6.2/Fedora 14 x64: it seems like mixing Ansistrings and Pchars on certain run time functions is a real no-no. I just spent HOURs, trying to see why I was not getting good program behavior. Lesson #1: Never call function like Copy( pchar, start,