From: elroy.jpl.nasa.gov!usc!petunia!nwebre@decwrl.dec.com (Neil Webre)
Subject: Re: Sliding Semantics?
Date: 8 Jul 91 18:03:46 GMT [thread overview]
Message-ID: <2878a902.2d8b@polyslo.CalPoly.EDU> (raw)
In article <1991Jul8.154928.24379@aio.jsc.nasa.gov> dean@sweetpea.jsc.nasa.gov
writes:
>In article <2871efdf.5c45@polyslo.CalPoly.EDU>, nwebre@polyslo.CalPoly.EDU (Ne
il Webre) writes:
>|>
>|> There are a couple of workarounds. The best we've been able to invent
>|> has been using type conversions. The substring statement, for instance,
>|> becomes
>|>
>|> declare
>|> type anchor is new string(1..len);
>|> begin
>|> s3 := (len, string(anchor(s2.text(posn .. posn + len - 1))));
>|> end;
>|>
>|> That "slides" the index range of the result to be from 1 to some value.
>|>
>
>Very interesting problem. I was unable to come a significantly better
>solution. One question I do have though, is there any advantage to
>using a subtype declaration for anchor, i.e.
>
> declare
> subtype anchor is string(1..len);
> begin
> s3 := (len, anchor(s2.text(posn .. posn + len - 1)));
> end;
>
>Will the compiler generate less code in this case since there is no
>type conversion? This works as desired on the Rational. Does it do
>the same thing on other machines / other Ada compilers?
>
>--
Good point. Your approach avoids a conversion back to type string.
Neil Webre
Cal Poly, San Luis Obispo, CA
Department of Computer Science
next reply other threads:[~1991-07-08 18:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1991-07-08 18:03 Neil Webre [this message]
-- strict thread matches above, loose matches on Subject: below --
1991-07-08 16:42 Sliding Semantics? cis.ohio-state.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!th
1991-07-08 15:49 Jack Dean (713) 283-4008
1991-07-03 15:40 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!petunia!nwebre
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox