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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Oberon and Wirthian languages Date: Wed, 23 Apr 2014 21:55:52 +0100 Organization: A noiseless patient Spider Message-ID: References: <1ljwj8f.1wqbhvuabsdw1N%csampson@inetworld.net> <51c7d6d4-e3be-44d5-a4ce-f7e875345588@googlegroups.com> <%J32v.70539$kp1.45343@fx14.iad> <8761m535e4.fsf_-_@ludovic-brenta.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="17b46ff0ef6492aedc2232708a5c5eff"; logging-data="32390"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GHuaF3MNmWp8aErBmUUexk2rCFBF3YIo=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:agObuqeJ7YB+dRPcM47hDtTH5v4= sha1:qA/E34oFL9H2wJxBzuyMFtQQp9Y= Xref: number.nntp.dca.giganews.com comp.lang.ada:186047 Date: 2014-04-23T21:55:52+01:00 List-Id: Simon Clubley writes: > I wonder if we need something like that for Ada proper so we don't > have to read the register into a temporary variable first in order to > guarantee a single register read and a single register write while > updating a subset of bitfields in the register. > > Having to use a temporary variable to guarantee a update of, say, a > couple of bitfields (out of a possible large number of bitfields) at > the same time just feels as if it isn't elegant. But hardware isn't (usually) elegant! If what the hardware designer wants is for you to read the register, change the values you need to in the local copy, then write the modified value back, that's what the code should do, surely, without relying on compiler magic with obscure pragmas to make it happen? (Ada's pragma Atomic is quite obscure enough already!)