comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Problem in "X (1).Re := X (1).Re + 1"
Date: Tue, 15 May 2012 01:09:18 -0500
Date: 2012-05-15T01:09:18-05:00	[thread overview]
Message-ID: <josrui$ka5$1@munin.nbi.dk> (raw)
In-Reply-To: 16249910.1154.1336624012153.JavaMail.geo-discussion-forums@pbyy9

"ytomino" <aghia05@gmail.com> wrote in message 
news:16249910.1154.1336624012153.JavaMail.geo-discussion-forums@pbyy9...
> On Thursday, May 10, 2012 9:58:04 AM UTC+9, Randy Brukardt wrote:
>>
>> This reminds me of something I forgot: The beauty of
>> Constant_Reference/Reference in the standard containers is that there 
>> cannot
>> be a dangling pointer (assuming no Unchecked programming is involved). 
>> These
>> are tampering events so long as the pointer still exists, and thus is it
>> impossible to modify the container (attempts to do so will raise
>> Program_Error).
>
> I agree, generally.
>
> Only in the cases of my and Adam's sample code, we have hoped that they 
> work through
>with reference-counting or no reference-counting. So any exceptions are 
>unsuitable.

"Unsuitable"? Doing dangerous things ought to be prevented; that's the point 
of the exceptions. And keeping uncontrolled pointers into a container that 
might be modified is one of those dangerous things. It took a *lot* of 
convincing that it could be possible to safely allow pointers at container 
elements.

Also note that not all container modifications are prevented, mostly ones 
that would cause trouble (although this is rather conservative).

Obviously, you can write your own container that allows any unsafe things 
you want, but that's not possible with the Standard containers.

                                   Randy.





  reply	other threads:[~2012-05-15  6:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-05 12:55 Problem in "X (1).Re := X (1).Re + 1" ytomino
2012-05-07 15:37 ` Adam Beneschan
2012-05-07 18:53   ` ytomino
2012-05-07 21:28     ` Adam Beneschan
2012-05-08  1:14       ` Randy Brukardt
2012-05-08 17:14         ` Adam Beneschan
2012-05-08 22:29           ` Randy Brukardt
2012-05-09  8:41             ` ytomino
2012-05-10  0:52               ` Randy Brukardt
2012-05-10  5:23                 ` ytomino
2012-05-09  9:29           ` ytomino
2012-05-10  0:58             ` Randy Brukardt
2012-05-10  4:26               ` ytomino
2012-05-15  6:09                 ` Randy Brukardt [this message]
2012-05-15 20:17                   ` ytomino
2012-05-16  0:01                     ` Randy Brukardt
2012-05-15 22:12               ` Simon Wright
2012-05-16  7:14                 ` Dmitry A. Kazakov
2012-05-09  8:05       ` ytomino
2012-05-09 11:03         ` ytomino
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox