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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: Oberon and Wirthian languages Date: Tue, 22 Apr 2014 00:34:09 +0000 (UTC) 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> Injection-Date: Tue, 22 Apr 2014 00:34:09 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="e458ff8b81bc0c159989eb0e36c6e372"; logging-data="20309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1979iDxzlmUopJQvk41AAcNQfR/+qm+oKA=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:Ufudf6KVm++N36UJzfmVMEP+enw= Xref: news.eternal-september.org comp.lang.ada:19482 Date: 2014-04-22T00:34:09+00:00 List-Id: On 2014-04-21, Jeffrey Carter wrote: > On 04/21/2014 06:06 AM, Simon Clubley wrote: >> >> What I have not checked however is if a record assignment in Ada to a bit >> field record variable marked as Atomic would result in all the bit fields >> listed in the assignment being _guaranteed_ to be updated at the same time >> or whether there would just be a atomic update of each component in >> isolation. > > If you have a record: > > type Register_Info is record > A : Boolean; > ... > end record; > > for Register_Info use record > A at 0 range 0 .. 0; > ... > end record; > > and an atomic object of the type: > > Register : Register_Info; > pragma Atomic (Register); > > If the compiler accepts the pragma, then assignment to Register (as opposed to > its components) is atomic: > > Register := (A => True, ...); > Thank you. It was not at all 100% clear from the RM if Ada offered the _guarantee_ that if you had, say, 3 components in a record assignment for a atomic bitfield record, that the record assignment would be treated as one atomic operation instead of 3 atomic operations (one for each component). > Though the best bet is to do it and check the generated code. > Unfortunately, that only tells you how one compiler implemented it and doesn't say anything about if such behaviour is mandatory in the standard. Thanks for the clarification above, Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world