[fpc-pascal]ansistring question
Mark Emerson
mark at angelbase.com
Fri Jan 3 18:24:43 CET 2003
Jonas Maebe wrote:
>
> On vrijdag, jan 3, 2003, at 16:28 Europe/Brussels, Mark Emerson wrote:
>
> > Consider the equation in the if statement:
> >
> > var
> > a, b : ansistring;
> >
> > begin
> > a := 'hello world..and a lot of other stuff to make this string
> > long';
> > b := a;
> > if a=b then write ('idential');
> > end.
> >
> > How is a=b evaluated? I hope/presume the text in the string is not
> > taken into consideration at all, and that the system can immediately
> > see that they are identical. Am I right?
> No. How would the system know that?
Well...you answered your own question, Jonas, when you say "it would be possible"....
> It would be possible to make the comparison a two step
> process, in which we first check whether the ansistrings point to the
> same ansistring structure and only if that fails, start doing an actual
> string compare,
MY question is...does FPC in fact do this? In my example, a and b DO
point to the same ansistring structure, because b := a.
Peter Vremen has answered my question:
> Yes.
And I am delighted with Peter's answer, but concerned that the two of
you gave opposite answers.
Mark
More information about the fpc-pascal
mailing list