Re: Internal error 8888 (was Re: [fpc-pascal]Strange Segfault...)

2003-07-14 Thread Alan Mead
--- [EMAIL PROTECTED] wrote: > > {$H+} > or > {$H-} > > definitely works. Sorry, by does nothing I meant that it does nothing to solve my problems with strings. Of course, the fundamental problem is that I don't fully understand anything but old-fashioned TP strings. [EMAIL PROTECTED] seq-baye

Re: Internal error 8888 (was Re: [fpc-pascal]Strange Segfault...)

2003-07-14 Thread Jonas Maebe
On maandag, jul 14, 2003, at 20:31 Europe/Brussels, Alan Mead wrote: If there is, I cannot find it. {$H} does nothing and I re-read the portion of the docs that deal with the sting types again and I don't see what I'm doing wrong. There is a difference between longstrings and ansistrings. Ansistri

Re: Internal error 8888 (was Re: [fpc-pascal]Strange Segfault...)

2003-07-14 Thread Michael . VanCanneyt
On Mon, 14 Jul 2003, Alan Mead wrote: > > --- James Mills <[EMAIL PROTECTED]> wrote: > > On Mon, Jul 14, 2003 at 06:48:06AM -0700, Alan Mead wrote: > > > I'm running into this string problem as well. I'd like to use > > > strings longer than 255 but I get strange errors like: > > > > [...] > >

Internal error 8888 (was Re: [fpc-pascal]Strange Segfault...)

2003-07-14 Thread Alan Mead
--- James Mills <[EMAIL PROTECTED]> wrote: > On Mon, Jul 14, 2003 at 06:48:06AM -0700, Alan Mead wrote: > > I'm running into this string problem as well. I'd like to use > > strings longer than 255 but I get strange errors like: > > [...] > I believe there is a compiler switch. If there is, I

Re: [fpc-pascal]Strange Segfault...

2003-07-14 Thread James Mills
On Mon, Jul 14, 2003 at 06:48:06AM -0700, Alan Mead wrote: > I'm running into this string problem as well. I'd like to use > strings longer than 255 but I get strange errors like: > > [EMAIL PROTECTED] seq-bayes]$ fpc mcmc3pl.pas > Free Pascal Compiler version 1.0.6 [2002/05/23] for i386 > Copyri

Re: [fpc-pascal]Strange Segfault...

2003-07-14 Thread Alan Mead
I'm running into this string problem as well. I'd like to use strings longer than 255 but I get strange errors like: [EMAIL PROTECTED] seq-bayes]$ fpc mcmc3pl.pas Free Pascal Compiler version 1.0.6 [2002/05/23] for i386 Copyright (c) 1993-2002 by Florian Klaempfl Target OS: Linux for i386 Compili

Re: [fpc-pascal]Strange Segfault...

2003-07-14 Thread Matt Emson
> Yes and no. Why is it so bad to write a function in that way ? It could > of course be written two different ways, but I'd rather this way where I > modify the string passed to the function. > > Explain it to me :) (I'm the only one that works on this project of > ~30,000 LOC, so I don't see any

Re: [fpc-pascal]Strange Segfault...

2003-07-13 Thread James Mills
On Sun, Jul 13, 2003 at 09:56:20PM +0100, Matt and Lisa Emson wrote: > > And yes Matt > > Emson, I do understand why my original functions weren't working :) > > including the part about not passing Strings as var params too? ;-P Yes and no. Why is it so bad to write a function in that way ? It c

Re: [fpc-pascal]Strange Segfault...

2003-07-13 Thread Matt and Lisa Emson
> And yes Matt > Emson, I do understand why my original functions weren't working :) including the part about not passing Strings as var params too? ;-P ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pasc

Re: [fpc-pascal]Strange Segfault...

2003-07-13 Thread James Mills
On Fri, Jul 11, 2003 at 06:41:22AM -0700, Jeff Pohlmeyer wrote: > (* > How about using "set of char" instead of "array of char" ? > That way, the compiler should be able to distinguish > between the overloads... > *) > program repl; > > type > tSetOfChar = set of char; > > procedure repl

Re: [fpc-pascal]Strange Segfault...

2003-07-11 Thread Matt Emson
> (* > How about using "set of char" instead of "array of char" ? > That way, the compiler should be able to distinguish > between the overloads... > *) Yeah, that will work ;-) The only problem would be if he wanted to remove specific patterns of chars, but I'm guessing this isn't the case.

Re: [fpc-pascal]Strange Segfault...

2003-07-11 Thread Jeff Pohlmeyer
(* How about using "set of char" instead of "array of char" ? That way, the compiler should be able to distinguish between the overloads... *) program repl; type tSetOfChar = set of char; procedure replace(chars: tSetOfChar; const replace: String; var s: String); var i: Integer; begin

Re: [fpc-pascal]Strange Segfault...

2003-07-11 Thread Michael Van Canneyt
On Fri, 11 Jul 2003, Matt Emson wrote: > > Normally the performance hit is nearly zero. > > No copying is done, only a reference count is increased. As it is a > > const, it cannot be assigned to anyway, so there will be no copy-on- > > write operation. > > > > It is always a good idea to use 'C

Re: [fpc-pascal]Strange Segfault...

2003-07-11 Thread Matt Emson
> Normally the performance hit is nearly zero. > No copying is done, only a reference count is increased. As it is a > const, it cannot be assigned to anyway, so there will be no copy-on- > write operation. > > It is always a good idea to use 'Const' parameters as it will stop you from > assigning

Re: [fpc-pascal]Strange Segfault...

2003-07-11 Thread Michael Van Canneyt
On Fri, 11 Jul 2003, Matt Emson wrote: > > BTW, if you are using longstrings, you shouldn't be passing by reference, as > the longstring (AnsiString) is already a pointer. If FPC handles memory in a > similar way to Delphi with respects to longstrings, it may cause a > performance hit if the str

Re: [fpc-pascal]Strange Segfault...

2003-07-11 Thread Matt Emson
> Well ok thanks Matt, however I kind of already had this figured out, but > was posting here to find out if there's a way around it (other than > naming two separate functions)... > > Perhaps there isn't... James, only tested in Delphi, but the following would seem to work procedure repla

Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread James Mills
On Thu, Jul 10, 2003 at 05:25:21PM +0100, Matt Emson wrote: > > > procedure replace(search: String; replace: String; var s: String); > > > procedure replace(const chars: array of char; replace: String; var s: > String); > > > > A string, or a array of char? > > James, this (as Marco put it) was ex

Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread Matt Emson
> > procedure replace(search: String; replace: String; var s: String); > > procedure replace(const chars: array of char; replace: String; var s: String); > > A string, or a array of char? James, this (as Marco put it) was exactly what I had in mind. The compiler will have to make a decision, and a

Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread James Mills
On Thu, Jul 10, 2003 at 05:26:31PM +0200, Marco van de Voort wrote: > > 15 replace(['0'..'9'], w, s); > > (gdb) s > > > > Program received signal SIGSEGV, Segmentation fault. > > $08066073 in main () at test4.pas:15 > > 15 replace(['0'..'9'], w, s); > > (gdb) > > Passin

Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread Marco van de Voort
> 15 replace(['0'..'9'], w, s); > (gdb) s > > Program received signal SIGSEGV, Segmentation fault. > $08066073 in main () at test4.pas:15 > 15 replace(['0'..'9'], w, s); > (gdb) Passing a set ( ['0'..'9'] ) to > procedure replace(search: String; replace: String; var s

Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread James Mills
On Thu, Jul 10, 2003 at 03:58:02PM +0100, Matt Emson wrote: > James, have you tried using non overloaded function calls?? ie. StrReplace > and ArrReplace etc. It should take a few minutes to implement, and may yield > the answer you're seeking. > > I still prefer the way Delphi overloads. At least

Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread Matt Emson
James, have you tried using non overloaded function calls?? ie. StrReplace and ArrReplace etc. It should take a few minutes to implement, and may yield the answer you're seeking. I still prefer the way Delphi overloads. At least it explicitly implies it is doing so. Matt __

[fpc-pascal]Strange Segfault...

2003-07-10 Thread James Mills
(gdb) break 14 Breakpoint 1 at $806603c: file test4.pas, line 14. (gdb) run Starting program: /home/pircsrv/src/test4 Enter a string: [EMAIL PROTECTED] Replace all digits with ? Breakpoint 1, main () at test4.pas:14 14 readLn(w); (gdb) n X 15 replace(['0'..'9'], w, s); (g