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: AW: [fpc-pascal]how to assign a value to an untyped variable

2003-07-11 Thread Michael Van Canneyt
On Fri, 11 Jul 2003, ZINTEL Gerhard wrote: > > > > Hello all, > > > > Friday, July 11, 2003, 3:18:58 PM, you wrote: > > > > ZG> hello list members, > > ... > > ZG> which type to be used for a type cast (that is not > > allowed for the left > > ZG> side) or how to use an address operator to manag

AW: [fpc-pascal]how to assign a value to an untyped variable

2003-07-11 Thread ZINTEL Gerhard
> > Hello all, > > Friday, July 11, 2003, 3:18:58 PM, you wrote: > > ZG> hello list members, > ... > ZG> which type to be used for a type cast (that is not > allowed for the left > ZG> side) or how to use an address operator to manage it? > at least in my fpc 1.0.6 typecasts for the left side a

Re: AW: [fpc-pascal]how to assign a value to an untyped variable

2003-07-11 Thread Michael Van Canneyt
On Fri, 11 Jul 2003, ZINTEL Gerhard wrote: > Thank you both for your fast help. And of course I meant "value := r;" > > I have found a third solution in the mean time (one should not give up to > early:) > Do you know if that is in a machine independent way? Yes. This is a language feature. Mi

AW: [fpc-pascal]how to assign a value to an untyped variable

2003-07-11 Thread ZINTEL Gerhard
Thank you both for your fast help. And of course I meant "value := r;" I have found a third solution in the mean time (one should not give up to early:) Do you know if that is in a machine independent way? procedure test(var value); var r : real absolute value; begin r := 1.0; // seems to w

Re: [fpc-pascal]how to assign a value to an untyped variable

2003-07-11 Thread Evergray
Hello all, Friday, July 11, 2003, 3:18:58 PM, you wrote: ZG> hello list members, ... ZG> which type to be used for a type cast (that is not allowed for the left ZG> side) or how to use an address operator to manage it? at least in my fpc 1.0.6 typecasts for the left side are allowed, value := r;

Re: [fpc-pascal]how to assign a value to an untyped variable

2003-07-11 Thread Michael Van Canneyt
On Fri, 11 Jul 2003, ZINTEL Gerhard wrote: > hello list members, > > could anyone of you give me a hint how to assign a value to an untyped > variable parameter of a procedure. E.G. in the following procedure: > > procedure test(var value); > var r : real; > begin > r := 1.0; > value := real

Re: [fpc-pascal]how to assign a value to an untyped variable

2003-07-11 Thread Evergray
Hello Gerhard, Friday, July 11, 2003, 3:18:58 PM, you wrote: ZG> hello list members, ZG> could anyone of you give me a hint how to assign a value to an untyped ZG> variable parameter of a procedure. E.G. in the following procedure: ZG> procedure test(var value); ZG> var r : real; ZG> begin ZG>

[fpc-pascal]how to assign a value to an untyped variable

2003-07-11 Thread ZINTEL Gerhard
hello list members, could anyone of you give me a hint how to assign a value to an untyped variable parameter of a procedure. E.G. in the following procedure: procedure test(var value); var r : real; begin r := 1.0; value := real;// does not work end; which type to be used for a type

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