comp.lang.ada
 help / color / mirror / Atom feed
From: dale@cs.rmit.edu.au (Dale Stanbrough)
Subject: Re: Alternate to Unchecked_Conversion - Portable?
Date: 1999/02/26
Date: 1999-02-25T22:56:45+00:00	[thread overview]
Message-ID: <dale-2602991000050001@dale.bu.cs.rmit.edu.au> (raw)
In-Reply-To: 7b3h1u$mv5$1@nnrp1.dejanews.com


> The only meaningful way to do that is to follow the
> prescription I gave. Trying to convert constrained to
> unconstrained pointers is always meaningless (and indeed
> will typically not even come close to "working" in many
> compilers)
> 
> > It can often be made to work ...
> 
> Famous last words. What this means is that by tweaking
> and fiddling, you can write something that appears to
> work at least in the limited cases in which you try it
> out on the particular version of the particular compiler
> you are using.



Why can't we have a routine (it would no doubt have been best
in  System.Address_To_Access_Conversions) that allows
for the creation of unconstrained pointers...

e.g.

   pointer := to_unconstrained_pointer (some_address, low_bound, upper_bound);

This way we could recover some of the Ada semantics back into our
arrays when interfacing with other langauges (esp. as we often know
the dimensions of the arrays we are dealing with).

Perhaps...

   System.Address_To_Access_Conversions.Array_Access

or
   System.Address_To_Array_Access_Conversions

?

For example if you have a pointer to a C string, you could use
the above as...


   X : String_Access := To_Unconstrained_Pointer (
                              C_String'address, 1, strlen (C_String));



Certainly this could only be reliably provided by the compiler vendors,
for the reasons already stated.

Dale




  reply	other threads:[~1999-02-26  0:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-21  0:00 Alternate to Unchecked_Conversion - Portable? Steve Doiel
1999-02-21  0:00 ` Steve Quinlan
1999-02-22  0:00   ` robert_dewar
1999-02-21  0:00 ` Matthew Heaney
1999-02-22  0:00 ` Tom Moran
1999-02-22  0:00 ` Christopher Green
1999-02-23  0:00   ` Matthew Heaney
1999-02-23  0:00     ` Samuel Mize
1999-02-24  0:00     ` robert_dewar
1999-02-25  0:00       ` Nick Roberts
1999-02-25  0:00         ` robert_dewar
1999-02-26  0:00           ` Nick Roberts
1999-02-26  0:00             ` Matthew Heaney
1999-02-27  0:00               ` Nick Roberts
1999-02-24  0:00   ` robert_dewar
1999-02-23  0:00     ` Christopher Green
1999-02-25  0:00       ` robert_dewar
1999-02-24  0:00         ` Christopher Green
1999-02-25  0:00           ` robert_dewar
1999-02-25  0:00             ` dennison
1999-02-25  0:00               ` Christopher Green
1999-02-26  0:00                 ` robert_dewar
1999-02-26  0:00                   ` Christopher Green
1999-03-01  0:00                     ` Nick Roberts
1999-03-01  0:00                       ` dewar
1999-03-01  0:00                         ` Nick Roberts
1999-02-26  0:00                 ` Tom Moran
1999-02-26  0:00                   ` robert_dewar
1999-02-26  0:00             ` Robert A Duff
1999-02-28  0:00               ` robert_dewar
1999-02-23  0:00     ` Christopher Green
1999-02-25  0:00       ` robert_dewar
1999-02-24  0:00         ` Christopher Green
1999-02-25  0:00           ` robert_dewar
1999-02-26  0:00             ` Dale Stanbrough [this message]
1999-02-26  0:00               ` Robert A Duff
1999-02-22  0:00 ` robert_dewar
1999-02-22  0:00   ` Samuel Mize
replies disabled

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