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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc000d321972308e,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-13 18:49:14 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!caen!crl.dec.com!crl.dec.com!pa.dec.com!iberia.cca.rockwell.com!mlc From: mlc@iberia.cca.rockwell.com (Michael Cook) Message-ID: <00985E28.98D9FB40.9907@iberia.cca.rockwell.com> Subject: Fixed point operator visibility question Date: Thu, 13 Oct 1994 13:41:31 CDT X-Received: by usenet.pa.dec.com; id AA15292; Thu, 13 Oct 94 11:51:10 -0700 X-Received: by pobox1.pa.dec.com; id AA19011; Thu, 13 Oct 94 11:51:06 -0700 X-Received: from iberia.cca.rockwell.com by inet-gw-1.pa.dec.com (5.65/10Aug94) id AA18628; Thu, 13 Oct 94 11:40:54 -0700 X-Received: by iberia.cca.rockwell.com (MX V2.3) id 9907; Thu, 13 Oct 1994 13:41:31 CDT X-To: COMP.LANG.ADA.USENET@DECWRL.DEC.COM X-Cc: mlc@iberia.cca.rockwell.com Date: 1994-10-13T13:41:31-05:00 List-Id: I have a question about fixed point operations, based on the example at the end of this article. The example compiles using compilers from vendors B, C, and D. The example does not compile using a compiler from vendor A, unless the 'use' clause is in effect. My viewpoint is that fixed point division is defined by package STANDARD, see Ada RM, section 4.5.5, para 9-11. And so the division should be visible without the 'use' clause. Vendor A's claim is that the example deals with visibility of operations of derived types. The argument is that Fixed_Type is a derived type of an anonymous predefined fixed point type (RM 3.5.9 para 9). The derived type introduces a derived "/" operator, that hides the predefined "/" operator in the scope of the declaration of Fixed_Type (RM 3.4 para 5). The 'use' clause is needed to access the derived operation in a using context, per visibility rules in RM 8.3. The argument continues that it doesn't matter that Fixed_Type is a fixed point type. The same thing would happen if a derived type of, say, Integer was used. Which viewpoint is correct, or are both defendable? Is there an ACVC test that checks for this, or an AI that would help? Is vendor A correct and the others lax in visibility checking? I'd suggest some test like this for the ACVC suite if a definite position can be argued. For now, I'll just add the 'use' clause for expediency. Thanks for ideas. Michael Cook MLC@IBERIA.CCA.ROCKWELL.COM These are not the opinions of my employer. package Fixed_Type_Example is Fixed_Type_Delta : constant := 1.0 / (2.0 ** 27); type Fixed_Type is delta Fixed_Type_Delta range -16.0 .. 16.0; end Fixed_Type_Example; ------------------------- with Fixed_Type_Example; package Example is procedure Initialize; end Example; ------------------------- package body Example is -- Should 'use' clause be necessary? -- Adding the 'use' clause removes the compilation problem, -- but violates our coding standard. -- use Fixed_Type_Example; -- needed by vendor A type Value_Type is range -2**15 .. 2**15 - 1; procedure Initialize is H : Fixed_Type_Example.Fixed_Type; PH : Fixed_Type_Example.Fixed_Type; PCV : Value_Type; begin H := 6.236; PH := 0.0129; PCV := Value_Type (H / PH); end Initialize; end Example;