comp.lang.ada
 help / color / mirror / Atom feed
From: Frode Tenneboe <ft@alne.edh.ericsson.se>
Subject: Re: Optimising string handling in application
Date: Fri, 4 Apr 2003 10:44:50 +0000 (UTC)
Date: 2003-04-04T10:44:50+00:00	[thread overview]
Message-ID: <1049453076.981330@edh3> (raw)
In-Reply-To: 5uGia.304058$L1.86794@sccrnsc02

tmoran@acm.org wrote:
>> Follow-up question: Is it safe to asume that strings _allways_
>> start with 'First = 1 (provided the (sub)type starts with 1) except when
>> passing slices where 'First = start_of_slice?
>   Luckily, you needn't assume anything.  There are specific rules about
> the value of 'first.  If those rules, in some particular case, don't
> *guarantee* that 'first=1, then you can't "assume" that 'first=1.

Bad phrasing of the question. I looked in RM 4.3.3 (Array aggregates)
for an answer, but I'm still not absolutely certain that my perception
of strings (or other array-types for that matter) is correct.

For subprograms which can accept unconstrained arrys (eg. String)
it is necessary to use 'First and friends. Is this the only case where
it is not guaranteed that 'First = 1?

Example:

   procedure Replace_Callsign_In_Msg
     (Msg             : in out Dpu_Loc_Messages.T_Msg_Data_Str;
      Msg_Length      : in out T_Integer_32;
      Callsign        : in     Dpu_Loc_Messages.T_Msg_Callsign;
      Callsign_Length : in     Positive) is

If I were to call this with:

   Replace_Callsign_In_Msg
     (Msg             => Loc_Insert_Msg.Data(2..Loc_Insert_Msg.Data'Last),
      Msg_Length      => Loc_Insert_Msg.Data_Length-1,
      Callsign        => Individual_Callsigns.Callsigns(I).Callsign,
      Callsign_Length => Individual_Callsigns.Callsigns(I).Length);

Can I assume that 'First of Msg inside Replace_Callsign_In_Msg =1?

Where in RM is this dealt with?

Regards,
 -Frode

-- 
^ Frode Tenneb�               | email: Frode.Tennebo@eto.ericsson.se ^
| Ericsson AS., N-1788 Halden | Phone: +47 67 25 09 39               |
| with Standard.Disclaimer; use Standard.Disclaimer;                 |



  reply	other threads:[~2003-04-04 10:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-01 11:54 Optimising string handling in application Frode Tenneboe
2003-04-01 18:52 ` Jeffrey Carter
2003-04-02  3:17 ` Steve
2003-04-02  4:10 ` tmoran
2003-04-02  7:15   ` Frode Tenneboe
2003-04-02 18:23     ` tmoran
2003-04-04 10:13       ` Frode Tenneboe
2003-04-04 13:26         ` Preben Randhol
2003-04-04 14:42           ` Frode Tenneboe
2003-04-04 21:48             ` Warren W. Gay VE3WWG
2003-04-05  7:24               ` Pascal Obry
2003-04-04 14:08         ` Frank J. Lhota
2003-04-04 15:26           ` Robert Spooner
2003-04-04 21:49             ` Warren W. Gay VE3WWG
2003-04-04 17:43         ` tmoran
2003-04-04 21:42           ` Frode Tennebø
2003-04-02 19:03     ` tmoran
2003-04-04 10:44       ` Frode Tenneboe [this message]
2003-04-05  3:28         ` tmoran
2003-04-05  0:08     ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox