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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4873305131bf4d94 X-Google-Attributes: gid103376,public X-Google-Thread: 10261c,90121986704b5776 X-Google-Attributes: gid10261c,public X-Google-Thread: 1014db,4873305131bf4d94 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,4873305131bf4d94 X-Google-Attributes: gid109fba,public From: Simon Wright Subject: Re: Yet another stupid language war (was: ... the only languages you need!!) Date: 1997/11/03 Message-ID: #1/1 X-Deja-AN: 287967248 X-NNTP-Posting-Host: pogner.demon.co.uk [158.152.70.98] References: <34557f2b.1934172@news.mindspring.com> <3458D116.2D34@pseserv3.fw.hac.com> <63anc7$75p$1@darla.visi.com> <345947D2.D20EF8E9@horvath.com> <63d34m$ap7$1@darla.visi.com> <01bce627$82afbec0$400d6dce@my-pc.neosoft.com> Organization: At Home Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.lang.pascal.misc Date: 1997-11-03T00:00:00+00:00 List-Id: dewar@merv.cs.nyu.edu (Robert Dewar) writes: > Simon wrote > > pogner[8]$ cat sizes.ads > package Sizes is > type T is range -32768 .. 32768; > for T'Size use 16; > end Sizes; > pogner[9]$ gcc -c -gnatc sizes.ads > sizes.ads:3:18: size for "T" too small, minimum allowed is 17 > > > Robert notes > > For the above program, the error message from GNAT is most certainly > correct, the given range does require 17 bits. Probably what is intended > here is -32768 .. +32767, which on a 2's complement machine (i.e. pretty > much all machines in practice), will fit in 16 bits fine. > > Robert Dewar > Ada Core Technologies > Well, after I'd posted it occurred to me that I wasn't perhaps stricly on the point that the original poster was making. However, what I was trying to show was that if you make a demand for a size that can't be met, for whatever reason, *any* Ada compiler is going to tell you that what you want can't be done; there's no need for "tricks". So I deliberately chose a range that wouldn't work, to demonstrate the delightfully accurate error message that GNAT gives. -- Simon Wright Work Email: simon.j.wright@gecm.com GEC-Marconi Radar & Defence Systems Voice: +44(0)1705-701778 Command & Information Systems Division FAX: +44(0)1705-701800