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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,826cd690cb6a7585 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!newsfeed.straub-nv.de!feeder.news-service.com!aioe.org!.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Address and bit mask Date: Mon, 29 Aug 2011 18:46:28 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: <80d7ce1b-8621-47aa-8d03-4d168fd52b30@o9g2000vbo.googlegroups.com> NNTP-Posting-Host: Lf0Nl3CcQzx+ocHx9cmuGg.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Tom's custom newsreader Xref: g2news2.google.com comp.lang.ada:21693 Date: 2011-08-29T18:46:28+00:00 List-Id: > As far as I understand, your solution is to convert the address in > address_integer, manipulating it, and then converting it in address. > And all that stuff is because Address type is defined as private. > Am I right ? > > > Size/range of addresses are rather target dependent, so I'm curious as > > to what you wish to make 'portable'?... > > I mean a solution that works with the Address type without the need to > redefine everything. "New_Paint_Color := Old_Paint_Color + 3;" makes no sense in general, though in certain circumstances adding 3 to the numeric representation of a color may make a great deal of sense. Similarly, ANDing two addresses does not in general make any sense, but sometimes ANDing their bitwise representation may be just the thing. Ada tries to operate at the level of abstraction where a color is a color, not a number, and an address is an address, not a number. The compiler will catch abstraction level mismatches. If you want to do something at a lower abstraction level, you have to tell the compiler you are changing levels. That's what System.Storage_Elements is for.