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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7fd5a5da28dace78,start X-Google-Attributes: gid103376,public From: Stuart Hutchesson Subject: Renaming Fixed Point Mutiplicative operator in Ada 95 Date: 1998/05/19 Message-ID: <3561F32B.2F0B@innotts.co.uk>#1/1 X-Deja-AN: 354735048 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Newsgroups: comp.lang.ada Date: 1998-05-19T00:00:00+00:00 List-Id: In certain applications (notably safety critical systems) it is good practise to supply protected maths operators (guarding against overflow etc). In these applications the use of floating point is sometimes frowned upon also and a common solution is to use fixed point types and override/rename the mathematical operations. The following code fragment compiles on a number of Ada 83 systems (VAX Ada, XDAda, ActivAda) and on GNAT 3.09 (Ada95) package Test1 is type NewFixed is delta 0.01 range -1000.0 .. +1000.0; function MultFixed (LEFT : NewFixed; RIGHT : NewFixed) return NewFixed ; procedure Test1DoIt; end Test1; package body Test1 is function "*" (LEFT : NewFixed ; RIGHT : NewFixed ) return NewFixed renames Test1.MultFixed ; A1, A2, A3 : NewFixed; function MultFixed (LEFT : NewFixed; RIGHT : NewFixed) return NewFixed is begin return 0.0; end MultFixed; procedure Test1DoIt is begin A1 := A2 * A3; end Test1DoIt; end Test1; However this is thrown out by ObjectAda saying the line A1 := A2*A3 is ambiguous - it appears to match the context for the universal_fixed multipication operator as well as the renamed operator. Anyone know if this this a compiler bug or a correct interpretation of the Ada95 LRM?? If it is the latter then it seems to rule Ada95 out for systems that need to provide protected fixed point maths.