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-14 12:20:32 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: <3DFB9276.7070809@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> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 14 Dec 2002 20:19:16 GMT NNTP-Posting-Host: 63.184.33.61 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1039897156 63.184.33.61 (Sat, 14 Dec 2002 12:19:16 PST) NNTP-Posting-Date: Sat, 14 Dec 2002 12:19:16 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:31829 Date: 2002-12-14T20:19:16+00:00 List-Id: Alfred Hilscher wrote: > This program raises exception CONSTRAINT_ERROR for the second > assignment. It happens with GNAT 3.13p and 3.14p (on windows). > > Can someone explain why? Is this a compiler error or do I misunderstand > something? The reason Constraint_Error is raised is because the code violates a constraint. Why are you using Interfaces.C if you're not interfacing with C? Since the LHS of your assignment is type Byte, the expression is evaluated using function "/" (Left, Right : Byte) return Byte; The value passed to Left is not in the range of Byte. If you want this evaluated as a universal expression, you have to add a step: declare Value : constant := X'Size / 8; begin Y := Value; end; -- Jeff Carter "Why don't you bore a hole in yourself and let the sap run out?" Horse Feathers