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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, PLING_QUERY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c87947d5fda3d7e4,start X-Google-Attributes: gid103376,public From: geert@fozzie.sun3.iaf.nl (Geert Bosch) Subject: Operator visibility: why are modular types different??! Date: 1996/05/03 Message-ID: <4mbcuu$4ne@fozzie.sun3.iaf.nl>#1/1 X-Deja-AN: 152918348 organization: La Calandre Infortunee newsgroups: comp.lang.ada Date: 1996-05-03T00:00:00+00:00 List-Id: Recently I encountered a really nasty problem, which I find hard to work around. The situation is that I want to create a package that provides some types which are subtypes of Interfaces.C. (Example: subtype ULONG is Interfaces.C.unsigned_long) I want these types to be subtypes instead of new types, so the conversion functions from Interfaces.C can be used without extra conversions. On the other had, I want the user to directly use my ULONG type without having to bother about Interfaces.C. To make operations like = visible, I put ``use type ULONG'' in the spec of my package. For normal integer types this works as expected, but not for modular types. What's the difference and where can I find that in the RM? Below is a complete example to make my problem clear. The compiler is GNAT v3.01. I'm really looking forward to an answer! Regards, Geert PS. Please CC. to geert@sun3.iaf.nl since my news is unreliable :-( (WARNING: THIS PROBABLY IS NOT VALID ADA CODE!) procedure UseTest is package A is -- type I is range 0..2**32 - 1; -- Program compiles with this def. type I is mod 2**32; -- This gives visibility error end A; package B is subtype J is A.I; use type J; end B; use B; X : J := 1; begin if X /= 1 then null; end if; end UseTest; -- E-Mail: geert@sun3.iaf.nl *** As far as we know, there have not been *** Phone: +31-53-4303054 ** any undetected failures in our software. **