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,9e2776c05028676e X-Google-Attributes: gid103376,public From: Ken Garlington Subject: Re: Why Ada is not the Commercial Lang of Choice Date: 1997/06/18 Message-ID: <33A83DA9.67E@lmco.com>#1/1 X-Deja-AN: 249393410 References: <33a1c14d.155787285@news.mhv.net> <5o5hv9$dcd$1@goanna.cs.rmit.edu.au> Organization: Lockheed Martin Tactical Aircraft Systems 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. In Ada, something like: Memory_Mapped_Address : constant := 16#0100040#; Memory_Mapped_Value : Interfaces.C.unsigned; -- just to keep type compatibility for Memory_Mapped_Value'Address use Memory_Mapped_Address; Memory_Mapped_Value := 16#00344556#; And the neat thing is, Memory_Mapped_Value will always be mapped to the area of memory you want! No worries about your pointer being corrupted -- because there isn't a pointer! Who knows, now that the compiler knows that the address is fixed, you might even get more efficient code! > > Example: > #define mem_map_addr B0100040 > unsigned int *p; > > p = (unsigned int *) mem_map_addr; > > *p = 0x00344556; Claim: The Ada does the same thing, in the same number of lines, and it does it more safety, more clearly, and (gasp) possibly more efficiently! -- LMTAS - The Fighter Enterprise - "Our Brand Means Quality" Who uses Ada? See http://www.lmasc.lmco.com/f22 For job listings, other info: http://www.lmtas.com or http://www.lmco.com