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,c7d533acec91ae16 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Question for the folks who designed Ada95 Date: 1999/04/27 Message-ID: <7g3b5g$p92$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 471300393 References: <7g2qu4$ca4$1@usenet.rational.com> X-Http-Proxy: 1.0 x13.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Tue Apr 27 03:33:04 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-04-27T00:00:00+00:00 List-Id: In article <7g2qu4$ca4$1@usenet.rational.com>, "Corey Ashford" wrote: > > The problem with the interfaces package shift > operators is that they have fixed types. So it's > difficult to write code for types whose size can vary. What we do in GNAT to address this problem is to make the shift operators intrinsics. Here is a typical declaration from the Interfaces spec: pragma Import (Intrinsic, Shift_Left); The nice thing about this approach is that indeed you *can* apply this intrinsic to a user defined type. For example you can put the following in your code. type My_Modular is mod 2**Integer'Size; function Shift_Left (Value : My_Modular; Amount : Natural) return My_Modular; pragma Import (Intrinsic, Shift_Left); and this will work fine. Of course this is not guaranteed to be portable (perhaps the ARG should look at this one, since it is a perfectly legitimate implementation decision). -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own