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,345a8b767542016e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-15 09:29:57 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: kcline@optelnow.net (Kevin Cline) Newsgroups: comp.lang.ada Subject: Re: memory leakages with Ada? Date: 15 Mar 2002 09:29:57 -0800 Organization: http://groups.google.com/ Message-ID: References: <3c90af1e@news.starhub.net.sg> <3c91bf44.1892100@news.demon.co.uk> NNTP-Posting-Host: 198.23.5.11 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1016213397 20297 127.0.0.1 (15 Mar 2002 17:29:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 15 Mar 2002 17:29:57 GMT Xref: archiver1.google.com comp.lang.ada:21298 Date: 2002-03-15T17:29:57+00:00 List-Id: john.mccabe@emrad.ns.com (John McCabe) wrote in message news:<3c91bf44.1892100@news.demon.co.uk>... > On Fri, 15 Mar 2002 03:20:52 GMT, "Steve Doiel" > wrote: > > > nbBytes := GetNbBytes( dataSource ); > > declare > > dataBuffer : ByteBuffer( 1 .. nbBytes ); > > begin > > GetData( dataBuffer ); > > end; > > > >Where in C the code would look something like: > > > > nbBytes = GetNbBytes( dataSource ); > > dataPtr = (char *)calloc( nbBytes ); > > GetData( dataPtr ); > > free( dataPtr ); > > What's wrong with: > > nbBytes = GetNbBytes (dataSource); > { > char data[nbBytes]; This wasn't legal until C99, and is still not legal in C++. > GetData(data); > } > > ?