comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Interesting effects in array renaming
Date: Tue, 24 Jun 2003 09:35:11 +0200
Date: 2003-06-24T09:35:11+02:00	[thread overview]
Message-ID: <bd8uq6$q0jfa$1@ID-77047.news.dfncis.de> (raw)
In-Reply-To: bd6vaj$ogc$2@a1-hrz.uni-duisburg.de

Georg Bauhaus wrote:

> Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
> : It is same in both GNAT and ObjectAda, but it is absolutely legal
> : according to ARM. The problem is ARM itself. Which opens such a hole.
> : What sense have our complains about buffer overruns in C/C++, in
> : presense of this? It is also a range check optimization problem, because
> : the compiler cannot rely on subtype information. Very bad.
> 
> I don't think it is so bad, it is much more an issue of what
> renaming means, maybe?

No, it is an issue of which meaning has an explicit specifying of a subtype. 
I would not object if the syntax were:

X : renames Y;

But it isn't.

> Most prominently, you give another name
> to an entity, you don't make a new entity.

Really? To me a "view" is definitely an "entity". You probably mean that 
renaming should not create a new object. But it is no matter, imposing a 
constraint on an existing object does not change the object. It is merely a 
precondition.

> Why should the new
> name denote an entity wich has its bounds changed, despite
> being "just another name"?

The answer depends on whether bounds is a property of (1) a value or of (2) 
a type. For an unconstrained array type you have (1), for a constrained 
array [sub]type (2). So when you rename one to another you have a clash 
between (1) and (2). It has to be reconciled. In the example I gave

for I in Constrained'Range loop
   X2 (I) := 0;
end loop;

may raise Constraint_Error or else corrupt memory if range checks are 
suppressed. It is abolutely unacceptable. To put it in one sentence: either 
you change bounds or you check them.

-- 
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-06-24  7:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-22 14:52 Interesting effects in array renaming Dmitry A. Kazakov
2003-06-22 17:24 ` Jeffrey Carter
2003-06-23  8:12   ` Dmitry A. Kazakov
2003-06-23 10:29     ` Georg Bauhaus
2003-06-23 11:37       ` Dmitry A. Kazakov
2003-06-23 13:28         ` Georg Bauhaus
2003-06-24  7:35           ` Dmitry A. Kazakov [this message]
2003-06-24 14:38             ` Georg Bauhaus
2003-06-25 10:28               ` Dmitry A. Kazakov
2003-06-25 14:23                 ` Georg Bauhaus
2003-06-25 19:00                   ` Dmitry A. Kazakov
2003-06-24  2:35     ` Robert I. Eachus
2003-06-24  7:35       ` Dmitry A. Kazakov
2003-06-24 10:08         ` Lutz Donnerhacke
2003-06-24 11:53         ` Georg Bauhaus
2003-06-24 12:48           ` Dmitry A. Kazakov
2003-06-26  2:54             ` Randy Brukardt
2003-06-26  6:27               ` Vinzent Hoefler
2003-06-26 12:44                 ` Georg Bauhaus
2003-06-26 13:01                   ` Vinzent Hoefler
replies disabled

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