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.9 required=5.0 tests=BAYES_00,FROM_NUMERIC_TLD autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ffda156586947522 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news2.google.com!news.glorb.com!news-peer-lilac.gradwell.net!not-for-mail From: "Stuart" Newsgroups: comp.lang.ada References: <046f172d-90f7-4a23-a181-dd1461ebd94b@i18g2000prf.googlegroups.com> Subject: Re: volatile vs volatile_components Date: Thu, 6 Nov 2008 10:18:31 -0000 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 Message-ID: <4912c029$1_1@glkas0286.greenlnk.net> X-Original-NNTP-Posting-Host: glkas0286.greenlnk.net NNTP-Posting-Host: 20.133.0.1 X-Trace: 1225966720 news.gradwell.net 498 dnews/20.133.0.1:59280 X-Complaints-To: news-abuse@gradwell.net Xref: g2news1.google.com comp.lang.ada:2596 Date: 2008-11-06T10:18:31+00:00 List-Id: "REH" wrote in message news:046f172d-90f7-4a23-a181-dd1461ebd94b@i18g2000prf.googlegroups.com... > Is there a difference between defining an array with pragma volatile > vs volatile_components? The standard says that if the object is > volatile, its components are volatile. So, if the object is defined as > having volatile components, what does that say--if anything--about the > object as a whole? As Adam Beneschan notes elsewhere it is an interesting question and the LRM does not seem to shed much light on it. I was interested in what meaning might be attributed to a whole array assignment - does the LRM define a particular order in which the elements must be accessed. Also in an assignment such as: A2 := A1; should the whole of A1 be read (buffered) before the write to A2 commences (I think it should - but I am no language lawyer). I tried the code below with a compiler here and it seemed to perform both whole array assignments as direct element by element copies (read then write of an element). However, it also seemed to make a complete dogs dinner of the first case by effectively implementing: W := X; -- copied element by element!! W := W; -- copied element by element!! Seemingly an explicit violation of the rules!! A bug report methinks - but it would be interesting to be clear on exactly what the LRM requires it to do before submitting it. package T is pragma Elaborate_Body; type Element is mod 2**16; type Index is range 1..100; type V_Array is array(Index) of Element; pragma volatile(V_Array); type VC_Array is array(Index) of Element; pragma volatile_components(VC_Array); W,X : V_Array; pragma volatile(W); pragma volatile(X); Y,Z : VC_Array; E : Element; end T; package body T is begin -- Whole array assignments. W := X; Y := Z; -- Element by element assignments for comparison. for i in W'range loop X(i) := W(i); end loop; for i in Y'range loop Z(i) := Y(i); end loop; end T; -- Stuart