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-17 11:30:10 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uunet!sea.uu.net!sac.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: CONSTRAINT_ERROR - why? User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Tue, 17 Dec 2002 19:29:09 GMT Content-Type: text/plain; charset=us-ascii References: <3DFB7841.F898C02@t-online.de> <3DFB8495.A655C512@t-online.de> <616gta.hk3.ln@beastie.ix.netcom.com> <3DFC878D.B6966C37@t-online.de> <2a9jta.1p3.ln@beastie.ix.netcom.com> <3DFD38A7.6080204@acm.org> <3DFE1FFB.E1BB660E@t-online.de> <3DFF6AFB.A536A0CE@t-online.de> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:31979 Date: 2002-12-17T19:29:09+00:00 List-Id: Alfred Hilscher writes: > So could it be a way if I define a function "/" (a, b : Integer) return > BYTE within my code? Or wouldn`t it be used? Probably both "/" operators would be directly visible, so it would be ambiguous. What's wrong with this: X.Struct_Length := BYTE(Integer'(Fac_Conf_Struct'Size / 8)); or perhaps: X.Struct_Length := BYTE(Integer'(X'Size / System.Storage_Unit)); pragma Assert(X.Struct_Length*System.Storage_Unit = X'Size); -- Assert that it's an integer number of storage units. or even: generic type T is limited private; function Size_In_Storage_Elements return BYTE; function Size_In_Storage_Elements return BYTE is Result: constant BYTE := BYTE(Integer'(T'Size / System.Storage_Unit)); begin pragma Assert(Result*System.Storage_Unit = X'Size); return Result; end Size_In_Storage_Elements; - Bob