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,FREEMAIL_FROM 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 14:28:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!newsfeed.mathworks.com!btnet-peer0!btnet-peer1!btnet!newsr1.ipcore.viaginterkom.de!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: Alfred Hilscher Newsgroups: comp.lang.ada Subject: Re: CONSTRAINT_ERROR - why? Date: Sat, 14 Dec 2002 23:26:19 +0100 Organization: T-Online Message-ID: <3DFBB00B.230289A2@t-online.de> References: <3DFB7841.F898C02@t-online.de> <3DFB9276.7070809@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.t-online.com 1039904868 02 15139 YFm6EjsbSGa3M- 021214 22:27:48 X-Complaints-To: abuse@t-online.com X-Sender: 320001779794-0001@t-dialin.net X-Mailer: Mozilla 4.75 [de] (WinNT; U) X-Accept-Language: de Xref: archiver1.google.com comp.lang.ada:31830 Date: 2002-12-14T23:26:19+01:00 List-Id: Jeffrey Carter schrieb: > > 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? I extracted the example from a big (really big) application where heavy use off (hardware-) manufacturer provided dlls is done. > 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; Is there no way to avoid this extra assignment? I expected something like function "/" (Left, Right : universal_integer) return Byte; > -- > Jeff Carter > "Why don't you bore a hole in yourself and let the sap run out?" > Horse Feathers