--- ais/ai-00364.txt 2004/06/10 05:39:57 1.8 +++ ais/ai-00364.txt 2004/07/27 23:01:06 1.9 @@ -1,5 +1,7 @@ -!standard 04.05.05(20) 04-06-08 AI95-00364/03 +!standard 04.05.05(20) 04-06-29 AI95-00364/04 !class amendment 03-12-04 +!status Amendment 200Y 04-06-29 +!status ARG Approved 7-1-1 04-06-13 !status work item 04-02-29 !status received 03-09-29 !priority Medium @@ -8,9 +10,8 @@ !summary -This proposal attempts to alleviate the upward incompatibility -created by Ada 95 for users defining their own fixed-point -multiply or divide operators. +This proposal alleviates the upward incompatibility created by Ada 95 for +users defining their own fixed-point multiply or divide operators. !problem @@ -31,25 +32,25 @@ !wording -Change 4.5.5(20) as follows: +Change 4.5.5(20) to: - [Legality Rules] {Name Resolution} + Name Resolution The above two fixed-fixed multiplying operators shall not be used in a context where the expected type for the result is itself universal_fixed [-- the context has to identify some other numeric type to which the - result is to be converted, either explicitly or implicitly]. {An + result is to be converted, either explicitly or implicitly]. An explicit conversion is required on the result when using the above fixed-fixed multiplication operator when either operand is of a type having a user-defined primitive multiplication operator declared immediately within the same list of declarations as the type and with both formal parameters of a fixed-point type. A corresponding requirement applies to - the universal fixed-fixed division operator.} + the universal fixed-fixed division operator. - {AARM NOTE: We have made these into Name Resolution rules (one of them + AARM NOTE: We have made these into Name Resolution rules (one of them existed in Ada95 but as a Legality Rule) to ensure that user-defined primitive fixed-fixed operators are not made unusable due to the - presence of these universal fixed-fixed operators.} + presence of these universal fixed-fixed operators. !discussion @@ -59,17 +60,17 @@ universal-fixed incompatibility. Just have a name-resolution rule which forbids use of the universal-fixed operations if either operand type has at least one primitive user-defined multiply operator, in the case of the -univ-fixed multiply op, or either has at least one primitive user-defined -divide operator in the case of the univ-fixed divide op. +universal-fixed multiply operator, or either has at least one primitive user-defined +divide operator in the case of the universal-fixed divide operator. -This doesn't have any beaujolais effects, because it isn't a preference +This doesn't have any Beaujolais effects, because it isn't a preference rule. Just certain fixed-point type combinations can't be used with the universal-fixed multiply/divide operators, based strictly on whether one of them has its own primitive multiply/divide operators, even when these primitive operators are *not* visible. Note that we still allow the universal-fixed operators to be considered -if there is an explicit conversion on the result. This is intended to provide +if there is an explicit conversion on the result. This is provides Ada 83 compatibility. This implies that ambiguity is still possible, but only in the same places where ambiguity existed in Ada 83. A qualified expression on the result can be used to break the ambiguity in favor of @@ -93,7 +94,7 @@ dealt with a customer who was trying to figure out how to get their old Ada 83 fixed-point code to work, and the answer was not pretty. Basically they had to use non-operator functions like "mul" and "div", and live with the -fact that they couldn't prevent misuse of the predefined univ-fixed +fact that they couldn't prevent misuse of the predefined universal-fixed operators. There are various reasons to want to "opt out" of the universal-fixed @@ -105,7 +106,7 @@ With this rule, so long as each fixed point type has at least one primitive fixed-fixed "*" operator and one primitive fixed-fixed "/" operator, the -univ-fixed operators will never be used. +universal-fixed operators will never be used. !example @@ -127,18 +128,37 @@ X2, Y2 : T2 := ...; X3, Y3 : T3; begin - X3 := X1 * X2; -- Does not use univ-fixed operator, no ambiguity - X3 := X1 * X1; -- Error! Does not use univ-fixed operator, and - -- no user-defined op works either - X1 := X3 / X2; -- Does not use univ-fixed operator, no ambiguity - X3 := X1 / X2; -- Error! Does not use univ-fixed operator, - -- and no user-defined op works either - X3 := X3 * X3; -- Error! Does not use univ-fixed operator (because + X3 := X1 * X2; -- Does not use universal-fixed operator, no ambiguity + X3 := X1 * X1; -- Error! Does not use universal-fixed operator, and + -- no user-defined operator works either + X1 := X3 / X2; -- Does not use universal-fixed operator, no ambiguity + X3 := X1 / X2; -- Error! Does not use universal-fixed operator, + -- and no user-defined operator works either + X3 := X3 * X3; -- Error! Does not use universal-fixed operator (because -- X3 has a primitive which is fixed * fixed, even though -- X3 appears only as result type). X3 := T3(X3 * X3); -- OK, because of explicit conversion ---!corrigendum +!corrigendum 4.5.5(20) + +@drepl +@i<@s8<Legality Rules>> +The above two fixed-fixed multiplying operators shall not be used in a context +where the expected type for the result is itself @i<universal_fixed> -- the +context has to identify some other numeric type to which the result is to be +converted, either explicitly or implicitly. +@dby +@i<@s8<Name Resolution Rules>> +The above two fixed-fixed multiplying operators shall not be used in a +context where the expected type for the result is itself @fa<universal_fixed> +-- the context has to identify some other numeric type to which the +result is to be converted, either explicitly or implicitly. An +explicit conversion is required on the result when using the above +fixed-fixed multiplication operator when either operand is of a type having +a user-defined primitive multiplication operator declared immediately +within the same list of declarations as the type and with both formal +parameters of a fixed-point type. A corresponding requirement applies to +the universal fixed-fixed division operator. !ACATS test

Questions? Ask the ACAA Technical Agent