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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5117b1b6391a0e06 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!nwrdny02.gnilink.net.POSTED!0f19ed38!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: <4x_zc.40702$G%.32360@tornado.fastwebnet.it> Subject: Re: A simple ADA puzzle (I haven't the answer) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Message-ID: Date: Wed, 16 Jun 2004 17:01:40 GMT NNTP-Posting-Host: 141.154.58.140 X-Complaints-To: abuse@verizon.net X-Trace: nwrdny02.gnilink.net 1087405300 141.154.58.140 (Wed, 16 Jun 2004 13:01:40 EDT) NNTP-Posting-Date: Wed, 16 Jun 2004 13:01:40 EDT Xref: g2news1.google.com comp.lang.ada:1579 Date: 2004-06-16T17:01:40+00:00 List-Id: "Abby" wrote in message news:4x_zc.40702$G%.32360@tornado.fastwebnet.it... > > Thanx for your answer. Sorry if I don't show you well what my problem is, I > try again ;) : I have the structure as in my first post and I can't change > it, I mean, "someone" wrote that type and I must use it so i need to declare > a variable of that "monstrous" type and I can't change that type in anyway. > DO you know some way to declare and use it without any constraint error? > Thanx again! Which types can't you change? Just STRING_TYPE? If so, you can go with my second solution. If no changes can be made in any of the declarations through UNC_ARRAY_TYPE, then you have an impossible task. These declarations are very badly written, and I find it quite implausable that they were ever used in any real, working application. Any object of type UNC2_ARRAY_TYPE with more than a few components would use up all available memory. For this reason, it is hard to believe that an object of type RET2_TYPE with a Init more than 3 was ever created, so an unconstrained object of this type is completely out of the question. But wait! It gets worse: an unconstrained object of type RET_TYPE must have enough space for INTEGER'LAST unconstrained objects of type RET2_TYPE. Finally, we need 3 of these RET_TYPE objects! No wonder Constraint_Error was raised; the run time generated an arithmetic overflow when computing the amount of space required. My guess is that these declarations were written by someone who performed no other check on the code other than whether it compiles. These declarations are unusable, and that is reason enough to refuse to use them. If you provide more details about what this code is supposed to do, I could advise you as to how these type declarations should be written.