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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: General integer-types. Date: Sun, 07 Apr 2013 10:45:59 +0200 Organization: A noiseless patient Spider Message-ID: References: <4a0e3b63-7139-4f03-bae2-35beca608bda@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 7 Apr 2013 08:43:26 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="2b3884a634d8f846e0712b4e3a92507a"; logging-data="10905"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6MHgQ4VdB7VMWX0Y6TljL" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 In-Reply-To: <4a0e3b63-7139-4f03-bae2-35beca608bda@googlegroups.com> Cancel-Lock: sha1:Q7gUvHEje+H10w2Wc9hERALbgzw= X-Enigmail-Version: 1.5.1 Xref: news.eternal-september.org comp.lang.ada:14905 Date: 2013-04-07T10:45:59+02:00 List-Id: Le 07/04/2013 03:45, Shark8 a écrit : > Generic > Size : Positive; > Package SWF_Integer is > Exp : Constant Positive := Size-1; > > -- For some reason adding the "New Long_Long_Integer" allows > -- this to compile... but it might ignore the Size aspect. > Type Signed is New Long_Long_Integer Range -2**Exp..2**Exp-1 > with Size => Size; > > -- This doesn't work at all; Size is not static. > Type Unsigned is Mod 0..2**Size > with Size => Size; > > End SWF_Integer; > A type definition must be static, and a size aspect too. A generic formal is never static, therefore you can't define a type from a generic parameter. (but of course, a constraint needs not be static, this is why it works as a derived type). But then, all instantiations will use the same size as Long_Long_Integer, which is likely not what you want. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr