comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: [Q] : Unchecked conversion
Date: 1996/11/09
Date: 1996-11-09T00:00:00+00:00	[thread overview]
Message-ID: <dewar.847574078@merv> (raw)
In-Reply-To: 01bbce46$0f818680$829d6482@joy.ericsson.se


iJonas Nugren asks

"1)  Is this a Gnat(3.04a) imposed limitation on Unchecked_Conversion
     or is my code illegal irregardless of compiler?
"

asking about a case of unchecked conversion between uncosntrained array
types.

In the current version of GNAT, we have relaxed this restrictoin somewhat
and allow the source to be an unconstrained array, but not the target.
Letting the target be an unconstrained array is pretty bogus, where would
the bounds come from in the general case, yes, I guess you could allow
it in limited cases but it seems dubious (note that the DEC Ada 83
compiler has exactly the same set of restrictions -- that was the
inspiration for relaxing the GNAt rules).

You can easily do what you want however, by instantiating UC locally
for a constrained subtype with appropriate bounds. That's really a 
preferable way of doing things in any case.

Or you can do UC between pointers to such unconstrained types (that's
probably all the UC between the arrays does anyway, and that way you
avoid making a copy of the array, converting pointers just gives you
a different view of the data, and is usually preferable).





  reply	other threads:[~1996-11-09  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-09  0:00 [Q] : Unchecked conversion Jonas Nygren
1996-11-09  0:00 ` Robert Dewar [this message]
1996-11-12  0:00 ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
1996-11-10  0:00 [Q]: " Jonas Nygren
1996-11-10  0:00 ` Matthew Heaney
1996-11-10  0:00   ` Robert Dewar
1996-11-11  0:00     ` Matthew Heaney
1996-11-10  0:00 ` Robert Dewar
replies disabled

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