comp.lang.ada
 help / color / mirror / Atom feed
From: christoph.grein@eurocopter.com
Subject: Re: API design problem - buffer scatter I/O
Date: Sun, 23 Nov 2008 23:55:07 -0800 (PST)
Date: 2008-11-23T23:55:07-08:00	[thread overview]
Message-ID: <1b06d68d-a6d8-4af3-8464-92e44224dcd6@20g2000yqt.googlegroups.com> (raw)
In-Reply-To: wcc4p1zmmou.fsf@shell01.TheWorld.com

On 22 Nov., 23:16, Robert A Duff <bobd...@shell01.TheWorld.com> wrote:
> I didn't read the whole wikibook, but the particular part you point to
> above has quite a bit of misinformation.  Also, the early focus on
> "fat pointers" vs. "thin pointers" is confusing.  There's no reason
> to talk about such implementation details in an introductory tutorial.
> Especially if the details are wrong.
>
> There is no such concept as "fat pointer" or "thin pointer" in Ada!
>
> It does point to a real problem, though.  Given your above declarations,
> you might want to say:
>
>     This_Buf : aliased Stream_Element_Array (1..10);
>     That_Buf : aliased Stream_Element_Array (1..10_000);
>
>     Scatter_Input_Data ((This_Buf'Access, That_Buf'Access)); -- wrong!
>
> but that's illegal.  You can do this instead:
>
>     This_Buf : aliased Stream_Element_Array := (1..10 => <>);
>     That_Buf : aliased Stream_Element_Array := (1..10_000 => <>);
>
>     Scatter_Input_Data ((This_Buf'Access, That_Buf'Access)); -- OK

May be the nomenclature in wiki is wrong or confusing (and you always
have to be skeptical about the contents), but the incompatibilities
described there exist. And I remember a discussion with Robert Dewar
that Access_To_Address_Conversion does not work for access to
unconstrained just because of the bounds (in GNAT, this is just an
Unchecked_Conversion of the Address in either way).

So, Bob, could you please elaborate about what is wrong in this
description.

And I disagree that this should not be in wiki, because programmers
inevitable will fall into this trap (as I did) and the corresponding
RM pages are very difficult to grok. This is not an implementation
detail.

I do not know what a thin and a fat and a far pointer actually are,
I'm no Ada implementor. From my point of view as language user, a thin
pointer is simply an address, a fat pointer an address and the bounds.
So just the use of "thin" and "fat" is wrong, because it's an
implementation detail?



  parent reply	other threads:[~2008-11-24  7:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-22 16:05 API design problem - buffer scatter I/O Maciej Sobczak
2008-11-22 16:54 ` sjw
2008-11-22 19:43 ` george.priv
2008-11-22 22:16 ` Robert A Duff
2008-11-22 23:34   ` Maciej Sobczak
2008-11-23  0:01     ` Robert A Duff
2008-11-24  8:10       ` Brad Moore
2008-11-24  7:55   ` christoph.grein [this message]
2008-11-24 20:03     ` Robert A Duff
2008-11-25  5:59       ` christoph.grein
2008-11-25  8:34         ` Dmitry A. Kazakov
2008-11-25 14:25         ` Robert A Duff
2008-11-25 22:20       ` Randy Brukardt
2008-11-24 21:23     ` Robert A Duff
2008-11-22 23:01 ` Georg Bauhaus
2008-11-23  5:57 ` anon
2008-11-24 17:16 ` tmoran
2008-11-26  8:34   ` Maciej Sobczak
2008-11-26 20:39     ` sjw
replies disabled

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