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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,148d39ae0d22411d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-29 15:28:41 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3BB64B13.81AFFB4D@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Pragma Volatile References: <3BB08F9C.BFB01047@raytheon.com> <3BB10D52.4D455DBA@raytheon.com> <3BB60733.4A80708A@avercom.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 29 Sep 2001 22:28:41 GMT NNTP-Posting-Host: 206.133.140.169 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1001802521 206.133.140.169 (Sat, 29 Sep 2001 15:28:41 PDT) NNTP-Posting-Date: Sat, 29 Sep 2001 15:28:41 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Sat, 29 Sep 2001 15:25:14 PDT (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:13523 Date: 2001-09-29T22:28:41+00:00 List-Id: minyard@acm.org wrote: > > Tucker Taft writes: > > > There shouldn't be any problem if you are using this in a mono-processor. > (talking about volatiles not being important on uniprocessors). >From my reading of Taft's post, he did not say that pragma Volatile was unimportant on uniprocessors. He said that achieving the desired volatility is not a problem on uniprocessors; that you can count on the compiler locating an object at an appropriate location if pragma Volatile applies to it. > Also, consider a register to reset a device, where you write a 0 then > a 1 to reset it. > > B : Register_Access; > > B.all := 0; > B.all := 1; > > Again, a compiler can say, "Hey, we can just ignore the first > operation, because it doesn't have any effect", from the compiler's > point of view. But setting B volatile guarantees that both operations > get done. Actually, I'm not sure of the syntax here, because what B > references is volatile, not B itself. So I'm guessing you would have > > type Register_Access is access all Integer; > pragma Volatile(Register_Access); If a register is an Integer, I would generally do B : Integer; for B'Address use Register_Location; pragma Volatile (B); ... B := 0; B := 1; But then, I don't have the C pointer fixation. -- Jeff Carter "Go and boil your bottoms." Monty Python & the Holy Grail