From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dbaf05888e191cb6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-15 17:43:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsswitch.lcs.mit.edu!newsfeed.mathworks.com!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Access to array slices? References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1042681415 12.234.13.56 (Thu, 16 Jan 2003 01:43:35 GMT) NNTP-Posting-Date: Thu, 16 Jan 2003 01:43:35 GMT Organization: AT&T Broadband Date: Thu, 16 Jan 2003 01:43:35 GMT Xref: archiver1.google.com comp.lang.ada:33067 Date: 2003-01-16T01:43:35+00:00 List-Id: > 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.