comp.lang.ada
 help / color / mirror / Atom feed
From: aio!qbe!dean@eos.arc.nasa.gov  (Jack Dean (713) 283-4008)
Subject: Re: Sliding Semantics?
Date: 8 Jul 91 15:49:28 GMT	[thread overview]
Message-ID: <1991Jul8.154928.24379@aio.jsc.nasa.gov> (raw)

In article <2871efdf.5c45@polyslo.CalPoly.EDU>, nwebre@polyslo.CalPoly.EDU (Nei
l 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?

--
============================================================================
Jack Dean                               |
McDonnell Douglas Space Systems Co.     |
Houston, Tx.                            |
dean@sweetpea.jsc.nasa.gov              |
============================================================================

             reply	other threads:[~1991-07-08 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-07-08 15:49 Jack Dean (713) 283-4008 [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-07-08 18:03 Sliding Semantics? Neil Webre
1991-07-08 16:42 cis.ohio-state.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!th
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