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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e30b6046584172fe X-Google-Attributes: gid103376,public From: smize@news.imagin.net (Samuel Mize) Subject: Re: Help: Dynamic-size arrays using record discriminant. Date: 1998/10/16 Message-ID: <707p11$i1l$1@prime.imagin.net>#1/1 X-Deja-AN: 401827737 References: <361E3D0C.41AAC13B@classnet.co.il> Organization: ImagiNet Communications Ltd, Arlington, Texas Reply-To: smize@imagin.net (Samuel Mize) Newsgroups: comp.lang.ada Date: 1998-10-16T00:00:00+00:00 List-Id: In article <361E3D0C.41AAC13B@classnet.co.il>, Alon Matas wrote: >-- I have this problem: I believe this will work: procedure PROBLEM is type ARRAY_TYPE is array (INTEGER range <>) of NATURAL; type RECORD_TYPE (SIZE: INTEGER:= 5) is record VECTOR: ARRAY_TYPE (1..SIZE); end record; REC: RECORD_TYPE; -- SIZE will be 5 by default -- enough space will be allocated by many compilers -- to hold largest possible value, i.e. with -- SIZE=integer'last begin -- * * * -- REC gets initial values somehow -- * * * -- add New_Value to the end of Rec Rec := (SIZE => SIZE + 1, VECTOR => (VECTOR'RANGE => VECTOR (VECTOR'FIRST..VECTOR'LAST), VECTOR'LAST + 1 => New_Value)); Best, Sam Mize -- Samuel Mize -- smize@imagin.net (home email) -- Team Ada Fight Spam: see http://www.cauce.org/ \\\ Smert Spamonam