comp.lang.ada
 help / color / mirror / Atom feed
From: robert_dewar@my-dejanews.com
Subject: Re: Alternate to Unchecked_Conversion - Portable?
Date: 1999/02/25
Date: 1999-02-25T00:00:00+00:00	[thread overview]
Message-ID: <7b3h1u$mv5$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 36d51061.1537646@nntp.concentric.net

In article <36d51061.1537646@nntp.concentric.net>,
  cjrgreen@concentric.net (Christopher Green) wrote:
> Not quite meaningless; if you can construct the compiler-
> dependent dope associated with the access value, it
> most definitely works.  The result is quite nonportable,
> so it is appropriate only where the effort is worthwhile.

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.

You need to write code which you *know* will work because
you have a good foundation for reasoning about it and
your reasoning indicates that it is correct, not simply
that it works.

The simplest case of course is that you write strictly
portable RM guaranteed code that has no implementation
dependencies.

If you wander into implementation dependent areas, you
need to have a firm basis for your analysis that your
code is correct.

For example, your code may depend on the fact that the
representation of a C pointer and the representation of
an Ada pointer (other than pointer to unconstrained array)
are identical. This is a quite reasonable assumption,
followed by virtually every compiler, and is a well defined
assumption that can be verified if you move from one
compiler to another.

But writing erroneous junk that happens to work on one
compiler, or depending on some fiddling that is dependent
on the very specific layout, e.g. of array bounds in the
unconstrained pointer case, does NOT qualify.


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-02-25  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 ` Matthew Heaney
1999-02-21  0:00 ` Steve Quinlan
1999-02-22  0:00   ` robert_dewar
1999-02-22  0:00 ` Tom Moran
1999-02-22  0:00 ` robert_dewar
1999-02-22  0:00   ` Samuel Mize
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 [this message]
1999-02-26  0:00             ` Dale Stanbrough
1999-02-26  0:00               ` Robert A Duff
replies disabled

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