From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: *** X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5c1c45943bf6a5bc X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: 'first of strings returned from a function should be 1? Date: 1997/07/27 Message-ID: <01bc9a76$459c2250$4c8371a5@dhoossr>#1/1 X-Deja-AN: 259353554 Distribution: world References: <5rcaqi$le8$1@goanna.cs.rmit.edu.au> Organization: ADViCOM -- Advanced Internet Communications Newsgroups: comp.lang.ada Date: 1997-07-27T00:00:00+00:00 List-Id: What's wrong with Result_String (Result_String'first) for getting at the first character of a function result? >From my own experience, I know that it is easy to write a poor function returning a string result of which the first subscript is not 1, and I always make the effort to slice (if necessary) the result into the range 1 . result'length, but if you're using something you can't change, then something like New_Result (1 .. Result_String'length) := Result_String(Result_String'first .. result_String'first + Result_String'length -1) will do the job. David C. Hoos, Sr. Dale Stanbrough wrote in article <5rcaqi$le8$1@goanna.cs.rmit.edu.au>... > I suppose the subject line says it all... > > Should the 'first of a string returned from a function be 1? > > (Getting at the first character of such a string requires creating > a declare block... > > declare > result_String : constant String := Some_Function(Params); > result_char : constant Character := Result_String(1); > begin > ... > > rather than just... > > if Some_Function(Params)(1) = ... > > if this is the case). > > Dale >