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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9d303864ae4c70ad X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-14 08:47:01 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!news.linkpendium.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 14 Apr 2004 10:47:00 -0500 Date: Wed, 14 Apr 2004 11:46:59 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Reprise: 'in out' parameters for functions References: <5ad0dd8a.0404090512.15af2908@posting.google.com> <5ad0dd8a.0404091828.6e79bb4e@posting.google.com> In-Reply-To: <5ad0dd8a.0404091828.6e79bb4e@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <8Oadneu6eY9pweDdRVn-hA@comcast.com> NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-yXhRKZv8Gr113fsbmjWfjU2KPuPSSbR2SyrpD1sEnd6z7O+fWgQLHvJelJv+AQC3IE8gEuohztnbY1H!SNxowzRaxao7F6amzJCGdSsV/JMi6NXJT94W+o8CiiSlGht10AzENSW9MB672Q== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:7097 Date: 2004-04-14T11:46:59-04:00 List-Id: Wojtek Narczynski wrote: > Or the simplest possible: two protected counters, try to get the sum > atomically. Since this is trivial, I can only assume that you have two protected counters with no support for external locking in mind. Actually, you can even do that, by having one counter have a Sum operation that calls the other. The fact that two arbitrary counters cannot be added atomically in all cases is a feature of the real world, not of Ada. Certainly any two counters that can be managed with a P,V protocol can be added atomically. It is also possible if only one counter has P, V support. However, this whole subject is probably silly. If I give you a total outside of any locking which is guaranteed to have been correct at some point in the past, how do you know whether it was atomic or not? The answer has to be that it was possible to increment both counters with an atomic operation. (For example, any odd sum could be invalid.) But once we postulate atomic joint increments, atomic sums are obviously also possible. Reminds me of a lot of improvement requests for Ada 9X. "We want to do such and such." "Well, here is a simple example of how to do it in current Ada." "Oh, but our software development plan doesn't allow us to use Unchecked_Conversion." Well, fix your bloody SDP, you nit! Hmm. It sounds harsh said like that, but what they wanted to do was exactly the reason that their SDP forbid Unchecked_Conversion. Whether the SDP or the guy writing the improvement request was "right" in the context of a particular project was irrelevant to the design of Ada 9X. Ada, as designed, allowed SDPs to easily allow or forbid use of some features. (Right now the best example of this is the SPARK checker that forbids exceptions and dynamic allocations.) The intent was exactly to allow projects to "tailor" the subset they used. (I just ran into another CS professor who didn't understand that the Ada 83 "no subsets" rule was for validated compilers, not for projects. Sigh.) Back to the example that started all this. Either it "makes sense" to atomically lock both counters, or it doesn't. This is a design criteria, and will affect how the counters are implemented. If a later change adds this requirement, you may have to change the implementation of the counters. Said like that, it sounds so _obvious_. -- Robert I. Eachus "The terrorist enemy holds no territory, defends no population, is unconstrained by rules of warfare, and respects no law of morality. Such an enemy cannot be deterred, contained, appeased or negotiated with. It can only be destroyed--and that, ladies and gentlemen, is the business at hand." -- Dick Cheney