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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,211b7e860ed3ea2d,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-02-09 10:11:39 PST Path: nntp.gmd.de!newsserver.jvnc.net!yale.edu!spool.mu.edu!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!csn!boulder!news.coop.net!news.den.mmc.com!iplmail.orl.mmc.com!alcyone!rgilbert From: rgilbert@orl.mmc.com (Bob Gilbert) Newsgroups: comp.lang.ada Subject: Problem with Address Clauses Date: 9 Feb 1995 18:11:39 GMT Organization: Martin Marietta Orlando Distribution: world Message-ID: <3hdlsr$a8a@theopolis.orl.mmc.com> Reply-To: rgilbert@orl.mmc.com NNTP-Posting-Host: alcyone.orl.mmc.com Date: 1995-02-09T18:11:39+00:00 List-Id: I believe that I may have posted this problem to the group some time ago, so I appologize if I'm being somewhat redundant of if the question was answered earlier, but here goes: I'm using an Ada '83 compiler that appears to require a "static expression" for the address clause. This is preventing me from implementing generic packages which would provide an interface to various memory mapped devices, where multiple instances of these devices might exist for one processor and/or the device may be used on several different processors but at different base addresses. I know that I can "work around" this by using access types and unchecked conversion to resolve the mapping, but I feel that this should not be necessary and goes against the spirit of the Ada language (not portable, etc.). I've used this technique of writing generic interfaces to memory mapped devices with several other Ada compilers in the past with no problems, and it seems that this is an unreasonable limitation of this particular compiler. Do I have a valid gripe, or is the compiler vendor within the legal definition of the language? Also, the vendor informs me that this problem will still exist even with there Ada 95 offerings. Should I continue pressing the vendor on this point? The following is a sample piece of code that highlights the problem: with System; package Address_Clause is type SYSTEM_TYPE is (Ax, Bx); type BASE_ADDR_ARRAY is array (SYSTEM_TYPE) of SYSTEM.ADDRESS; X_Base_Table : constant BASE_ADDR_ARRAY := BASE_ADDR_ARRAY'(Ax => 16#0020_0000#, Bx => 16#0010_0000#); --------------------------------------------------------------- -- Ultimately this package would be implemented as a generic - -- where the array index (Ax) used to identify the system, - -- would be supplied as a generic parameter. The generic - -- implementation is not shown to avoid unnecessary - -- complications (this comment seems to provides sufficient - -- confusion anyway). - --------------------------------------------------------------- XBase : constant SYSTEM.ADDRESS := X_Base_Table(Ax); XAddr_1 : constant SYSTEM.ADDRESS := XBase + 0; X1 : INTEGER; for X1 use at XAddr_1; end Address_Clause; When I compile the above I get the following error: ____________________________________________________________________________ 23| X1 : INTEGER; 24| for X1 use at XAddr_1; ^1 *** 1 Error 3271: A static expression is expected here (4.9) 25| ____________________________________________________________________________ Thanks in advance for any inputs and opinions, -Bob