comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com
Subject: Re: win32ada design question/problem
Date: 1998/11/18
Date: 1998-11-18T00:00:00+00:00	[thread overview]
Message-ID: <72vjpm$ui9$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 36531538.483857@SantaClara01.news.InterNex.Net

In article <36531538.483857@SantaClara01.news.InterNex.Net>,
  tmoran@bix.com (Tom Moran) wrote:
> >I think a binding done with System.Address for pointers and strings, and
> >Interfaces.C.Int for integers, would be far better.
>   Why exactly is X'Address preferable to X'Unchecked_Access?
>   Having spent a fair amount of time in the past debugging/correcting
> supposedly portable code that incorrectly assumed an access type was a
> 'Address, I'm rather sensitive to this issue.

Its preferable philosophicly when I don't know and don't *care* what type of
object it points to, other than possibly its size. This is often the case in C
bindings and OS calls.

With access objects I have three choices:
  o  Write one binding for each C-routine/passed object combination I will
     ever want to use.
     Clearly unacceptable.

  o  Arbitrarily pick some dummy access type to use for the C-routine, and
convert other accesses and addresses into it.
     In keeping with the C approach, but Evil. Can cause confusion for
maintainers and other readers, and thus may cause bugs in the future.

  o  Create and use some unconstrained data array access object.  Not evil.
But unchecked conversion or address_to_access_conversion is still required to
get a value of this type. Careless attempts to dereference the pointer may
cause problems due to lack of bounds information. Way more work than using
Address.

--
T.E.D.

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




  reply	other threads:[~1998-11-18  0:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-13  0:00 win32ada design question/problem Mats Weber
1998-11-13  0:00 ` dennison
1998-11-16  0:00   ` Stephen Leake
1998-11-16  0:00     ` Tucker Taft
1998-11-17  0:00     ` dennison
1998-11-17  0:00       ` Mats Weber
1998-11-17  0:00         ` dennison
1998-11-17  0:00           ` Mats Weber
1998-11-17  0:00           ` Tucker Taft
1998-11-18  0:00             ` Tom Moran
1998-11-18  0:00               ` dennison
1998-11-13  0:00 ` Tom Moran
1998-11-16  0:00   ` Mats Weber
1998-11-18  0:00     ` Tom Moran
1998-11-18  0:00       ` dennison [this message]
1998-11-19  0:00       ` Mats Weber
1998-11-19  0:00         ` David Botton
1998-11-19  0:00           ` Mats Weber
1998-11-23  0:00             ` Marin David Condic
1998-11-19  0:00         ` dennison
1998-11-19  0:00           ` David Botton
1998-11-19  0:00       ` Mats Weber
1998-11-27  0:00     ` Roga Danar
  -- strict thread matches above, loose matches on Subject: below --
1998-11-19  0:00 tmoran
1998-11-19  0:00 ` dennison
1998-11-19  0:00   ` Tom Moran
1998-11-20  0:00     ` dennison
1998-11-20  0:00       ` Tom Moran
1998-11-23  0:00     ` Marin David Condic
1998-11-23  0:00       ` Mats Weber
1998-11-24  0:00         ` dennison
replies disabled

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