comp.lang.ada
 help / color / mirror / Atom feed
* Re: win32ada design question/problem
@ 1998-11-19  0:00 tmoran
  1998-11-19  0:00 ` dennison
  0 siblings, 1 reply; 10+ messages in thread
From: tmoran @ 1998-11-19  0:00 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1998-11-24  0:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-11-19  0:00 win32ada design question/problem 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       ` Ada Source Treasury (Re: win32ada design question/problem) David Botton
1998-11-22  0:00         ` Jerry van Dijk
1998-11-20  0:00       ` win32ada design question/problem Tom Moran
1998-11-23  0:00     ` Marin David Condic
1998-11-23  0:00       ` Mats Weber
1998-11-24  0:00         ` dennison

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