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-Thread: 103376,ffda156586947522 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!b2g2000prf.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: volatile vs volatile_components Date: Wed, 5 Nov 2008 17:21:25 -0800 (PST) Organization: http://groups.google.com Message-ID: <249486d2-c000-483f-af5b-4938ba6ccc51@b2g2000prf.googlegroups.com> References: <046f172d-90f7-4a23-a181-dd1461ebd94b@i18g2000prf.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1225934485 1171 127.0.0.1 (6 Nov 2008 01:21:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 6 Nov 2008 01:21:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b2g2000prf.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8319 Date: 2008-11-05T17:21:25-08:00 List-Id: On Nov 5, 7:00 am, REH wrote: > 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? Good question. With Volatile_Components, the simple answer would be that the array components are volatile but the array object as a whole is not. But after studying C.6, I have to admit that this doesn't make much sense. The purpose of Volatile is to make sure all reads and writes of a volatile object are done exactly as the program tells it to (no optimizing away of "redundant" loads, for instance); and if you declare an array's subcomponents to be Volatile, you want reads and writes of the components to occur just as the program says to do them, and I'd think that reading and writing the entire array, since it has volatile components, would mean that the array reads/writes would also have to take place just like the program says, in order for the desired effect to happen on the volatile components. In other words, I can't think of a single case where an operation on an array that has Volatile_Components but not Volatile specified should behave differently than the same operation on a Volatile array. -- Adam