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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9e2776c05028676e X-Google-Attributes: gid103376,public From: "Robert I. Eachus" Subject: Re: Why Ada is not the Commercial Lang of Choice Date: 1997/06/18 Message-ID: <33A7FBFF.29D2@mitre.org>#1/1 X-Deja-AN: 249349904 Organization: The MITRE Corporation Reply-To: eachus@mitre.org Newsgroups: comp.lang.ada Date: 1997-06-18T00:00:00+00:00 List-Id: Paul Van Bellinghen writes: > > Claim: > It is much easier in C, for example, to output a data word to > an I/O device that is memory mapped. > > Supporting Evidence: > 1 One need only define a pointer > 2 and assign it the memory mapped address > 3 then store the desired data value to the contents of the pointer. > > Example: > #define mem_map_addr B0100040 > unsigned int *p; > > p = (unsigned int *) mem_map_addr; > > *p = 0x00344556; > > Claim: > It is harder to do it in Ada because i write it out in more words. Wait a second here. The eqivalent Ada is: Mem_Map: Integer; for Mem_Map'Address use 16#B0100040#; begin Mem_Map := 16#00344556#; ...which is a little shorter in terms of characters, words, and lines. I could go into the bugs in both the Ada and the C--I'd want pragma Volitile(Mem_Map); in both Ada and C. Most compilers will get it "right" but why take the risk. Also, it might be necessary to call System.Storage_Elements.To_Address, but I can't imagine any compiler for a machine where 16#B01000040# is a meaningful address not allowing literals for addresses. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer;