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: 103376,cea03ed275aa3d28 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.germany.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!newsfeed01.chello.at!newsfeed02.chello.at!news.hispeed.ch.POSTED!not-for-mail Message-Id: <2308918.JaHNq6usfB@linux1.krischik.com> From: Martin Krischik Subject: Re: Question about generics. Newsgroups: comp.lang.ada Date: Sun, 02 Jul 2006 20:49:07 +0200 References: User-Agent: KNode/0.10.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@hispeed.ch Organization: hispeed.ch NNTP-Posting-Host: 80.218.119.160 (80.218.119.160) NNTP-Posting-Date: Sun, 02 Jul 2006 21:45:02 +0200 X-Trace: c752c44a8223ef57fd20513028 Xref: g2news2.google.com comp.lang.ada:5421 Date: 2006-07-02T20:49:07+02:00 List-Id: Peter C. Chapin wrote: > ere is what I'm trying to do > > generic > Size : in Integer; > package Xyzzy is > type Index is mod Size; > -- etc. > end Xyzzy; > > The compiler (gnat) complains about the modular type definition, saying > that Size is a non-static expression and that's no good. Do it the other way round: generic type Index is mod <>; package Xyzzy is Size : Integer := Index'Last + 1; -- etc. end Xyzzy; Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com