comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Access to array slices?
Date: Thu, 16 Jan 2003 01:43:35 GMT
Date: 2003-01-16T01:43:35+00:00	[thread overview]
Message-ID: <b7oV9.3045$1q3.114@sccrnsc01> (raw)
In-Reply-To: mailman.1042678681.23105.comp.lang.ada@ada.eu.org

>    Buf     : access IC.Char_Array; -- "in out" parameter
Actually it's an "in" parameter whose value is a pointer.
There aren't any "out" or "in out" parameters in C, just "in" pointers
to where an output value is supposed to go.

> technique which makes translation of "chars *buf" mindless (as in
> you don't have to RTFM to determine whether caller or callee
> allocates the memory :-)

  If the C function takes a "chars *buf" then the caller had better supply
a value, ie, allocate some memory and supply its address.  If the C
function wants to allocate memory and pass back a pointer to it, it will
usually have "chars **buf" or "Handle *h" where Handle is a pointer, ie, a
typedef for chars *buf.  So most of the time it should be pretty
straightforward to see who is supposed to allocate the memory.



  reply	other threads:[~2003-01-16  1:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-15  1:17 Access to array slices? Wojtek Narczynski
2003-01-15  3:13 ` tmoran
2003-01-15 16:31   ` sk
2003-01-15 20:48     ` tmoran
2003-01-16  1:00       ` sk
2003-01-16  1:43         ` tmoran [this message]
2003-01-19  4:06     ` David Thompson
2003-01-15 14:44 ` Steve
2003-01-16  2:18   ` Wojtek Narczynski
2003-01-16  3:52     ` tmoran
2003-01-17 18:04     ` Warren W. Gay VE3WWG
2003-01-15 15:06 ` Stephen Leake
2003-01-16  2:02   ` Wojtek Narczynski
2003-01-16 16:18     ` Stephen Leake
2003-01-16 16:48 ` Victor Porton
2003-01-19  4:32 ` sk
2003-01-27  2:59   ` David Thompson
2003-01-24 19:02 ` Wojtek Narczynski
replies disabled

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