comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: win32ada design question/problem
Date: 1998/11/19
Date: 1998-11-19T00:00:00+00:00	[thread overview]
Message-ID: <731rn7$kj5@lotho.delphi.com> (raw)

>   C_Function(S'Address);
>
>makes it clear that you are passing the whole of S.
> ....
>   C_Function(S(S'first)'Unchecked_Access);
>
>which does not make clear that S is passed as a whole.
   C_Function(Window_Name => S(S'first)'Unchecked_Access);
or
   C_Function(Control_Character => S(S'first)'Unchecked_Access);
Using a named parameter should make it clearer in either case.
A maintainer familiar with C would realize that all of S is
potentially accessible by S(S'first)'Unchecked_Access and would
have to look up C_Function to find out if it's acting on just
(S'first) or other parts of S.  Ditto S'Address.
(And of course S probably is intended to be an Interfaces.C.Char_Array,
not an Ada String.)

>- Try interfacing fcntl, setsockopt or some other weird functions using
>access types: these somtimes return, or take as a parameter, a pointer
>that points to a type that changes depending on the function you want to
>perform, which is determined by the value of another parameter. You can
>certainly do this with overloading, but I am not sure this buys much in
>a thin binding.
  This certainly happens, but relatively rarely.  I take it as yet
another argument against too-thin bindings.

>- It's the good old Ada 83 way that has worked for 15 years now, wo why
>change ?
  Actually, no. My first Ada 83 compiler used fat pointers for
unconstrained arrays and S'Address would not do what you expected in that
case - it was necessary to use S(S'first)'Address.
Tom Moran




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

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-19  0:00 tmoran [this message]
1998-11-19  0:00 ` win32ada design question/problem dennison
1998-11-19  0:00   ` Tom Moran
1998-11-20  0:00     ` dennison
1998-11-20  0:00       ` Tom Moran
1998-11-20  0:00       ` Ada Source Treasury (Re: win32ada design question/problem) David Botton
1998-11-22  0:00         ` Jerry van Dijk
1998-11-23  0:00     ` win32ada design question/problem Marin David Condic
1998-11-23  0:00       ` Mats Weber
1998-11-24  0:00         ` dennison
  -- strict thread matches above, loose matches on Subject: below --
1998-11-13  0:00 Mats Weber
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
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
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
replies disabled

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