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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7be3870dd9c9518f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-15 10:22:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DFCC831.2040103@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: CONSTRAINT_ERROR - why? References: <3DFB7841.F898C02@t-online.de> <3DFB9276.7070809@acm.org> <3DFC8B43.68D99D1C@t-online.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 15 Dec 2002 18:20:53 GMT NNTP-Posting-Host: 63.184.8.252 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1039976453 63.184.8.252 (Sun, 15 Dec 2002 10:20:53 PST) NNTP-Posting-Date: Sun, 15 Dec 2002 10:20:53 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:31853 Date: 2002-12-15T18:20:53+00:00 List-Id: Alfred Hilscher wrote: > > I tried, but - it does not compile: "non-static expression used in > number declaration". So it's _not_ a static expression and will generate > code which will be executed during runtime. > > I discussed the "why is 'size not static?" about half a year ago in cla > (when I tried to declare a "type a is array (1..(x'size/8)) of > character"). Another gotcha. At least is got me. type X is mod 2 ** 8; Z : constant := X'Size / 8; is fine, but type X is mod 2 ** 8; type Y is record A : X; end record; Z : constant := Y'Size / 8; isn't. This is one of those cases where the compiler has the information and could determine the value at compile time, but the language doesn't allow it. 'Size is static when the prefix is a static subtype, but only scalar and string subtypes can be static. GNAT 3.14p seems to have an error here, as it flags 'Size of static string subtypes as non-static. -- Jeff Carter "I'm a lumberjack and I'm OK." Monty Python's Flying Circus