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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a79ba897d64210ea X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: TYPE'Size in static expression Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4358A12B.4030601@dif.andthis.um.es> Date: Fri, 21 Oct 2005 10:55:03 +0200 Message-ID: NNTP-Posting-Date: 21 Oct 2005 10:55:07 MEST NNTP-Posting-Host: 4ca3658d.newsread2.arcor-online.net X-Trace: DXC=PgTTVY=5;dnmBTbc_2cXMbQ5U85hF6f;djW\KbG]kaMhSE6H=g?m\gjS5MJIjbEYgd[6LHn;2LCVn7enW;^6ZC`d<=9bOTW=MNn X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:5846 Date: 2005-10-21T10:55:07+02:00 List-Id: On Fri, 21 Oct 2005 10:04:59 +0200, Francisco J. Montoya wrote: > I'm trying to write a generic (container) package whose only parameter > is a type BaseType. I need to define an array of elements of this type > (some kind of buffer) but I'd like the size of this buffer to be > approximately constant regardless of the size of each BaseType element. > My first attempt was to make some definitions like the following: > > Buffer_Size : constant := 1024; -- 1Kb buffer > Num_Elements : constant := 8 * Buffer_Size / BaseType'Size; -- Wrong! Num_Elements : constant Integer := 8 * Buffer_Size / BaseType'Size; > type Buffer is array (1..Num_Elements) of BaseType; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de