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-18 10:52:07 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newspeer.radix.net!uunet!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: Wed, 18 Dec 2002 18:51:30 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> <3E00C040.A038AFCE@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:32044 Date: 2002-12-18T18:51:30+00:00 List-Id: Alfred Hilscher writes: > I have written a lot of code and there a many such assignments, because > the (C-)interface expects always the first component of a structure to > contain the structure length in bytes. So I want reduce the effort to > change the code. You're trying to convert a size in bits (of type universal_integer) to a size in bytes (of type BYTE). And you're doing that all over the place. So it seems to me you should encapsulate that operation. It's not hard to write a function to do that. I also suggested a generic, which is a bit heavy, but does the job. Yes, you'll have to change all your code to refer to the encapsulated operation. > The main problem is, that GNAT does the compile without error and > without warning (at least when invoked from AdaGide), and the exception > is detected only during runtime (Aonix shows a warning during > compilation). I had to write a lot of code before I could do the first > run. If I'd got an warning during compilation then the problem had been > detected in an early phase and the changes were minimal. Yes, I agree this is a language design flaw. I'm glad to hear the Aonix compiler at least gave a warning (since I work for SofCheck, and Aonix uses SofCheck's AdaMagic front end). (Modular types are one of my least favorite features of Ada 95.) - Bob