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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d00514eb0749375b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Vinzent Hoefler" Newsgroups: comp.lang.ada Subject: Re: initialize an array (1-D) at elaboration using an expression based on the index? Date: Sat, 16 Oct 2010 03:11:27 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: individual.net PCDBTWVPkLks0L9hAvoG0Anq/2bMrN0Rl3bJx4Xx/bcZa8MK1m Cancel-Lock: sha1:vA1uaQsdceFTvAnzcHuIYiuC2T8= User-Agent: Opera Mail/10.62 (Win32) Xref: g2news2.google.com comp.lang.ada:15528 Date: 2010-10-16T03:11:27+02:00 List-Id: On Sat, 16 Oct 2010 02:54:05 +0200, Gene wrote: > It's ugly, but you can get the effect with something like: > > Initializer_Index : Natural := 0; > > function Initial_Function_Of_Index return Float is > begin > Initializer_Index := Initializer_Index + 1; > return 2.0 * Float(Initializer_Index); > end; > > A : array(1 .. 100) of Float := (others => > Initializer_Function_Of_Index); Don't try this at home, kids. See ARM 4.3.3(23) about evaluation order. Vinzent. -- There is no signature.