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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d855403bbf39dab1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.189.72 with SMTP id gg8mr7617558pbc.4.1328381278427; Sat, 04 Feb 2012 10:47:58 -0800 (PST) Path: lh20ni260401pbb.0!nntp.google.com!news1.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsgate.cuhk.edu.hk!news.netfront.net!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: can one create an array of a size determined by a constant value of a function? Date: Sat, 04 Feb 2012 11:47:29 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: NNTP-Posting-Host: 97.215.60.200 Mime-Version: 1.0 X-Trace: adenine.netfront.net 1328381277 23259 97.215.60.200 (4 Feb 2012 18:47:57 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Sat, 4 Feb 2012 18:47:57 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111229 Thunderbird/9.0 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-02-04T11:47:29-07:00 List-Id: On 02/04/2012 04:00 AM, Nasser M. Abbasi wrote: > "constexpr int get_five() {return 5;} > int some_value[get_five() + 7]; // Create an array of 12 integers. Legal C++11 > This allows the compiler to understand, and verify, that get_five is > a compile-time constant. > " With Ada, you can declare an array with a size not known at compile time: function Get return Positive is -- null; begin -- Get return Integer (Ada.Calendar.Seconds (Ada.Calendar.Clock) ); end Get; S : String (1 .. Get); -- Jeff Carter "Nobody expects the Spanish Inquisition!" Monty Python's Flying Circus 22 --- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---