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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1042f393323e22da X-Google-Attributes: gid103376,public From: clines@delete_this.airmail.net (Kevin Cline) Subject: Re: Any research putting c above ada? Date: 1997/05/14 Message-ID: #1/1 X-Deja-AN: 241412056 References: <208C9C61CA05C32B.65D82DC950AAA33A.D68E7B27EB42E98A@library-proxy.airnews.net> <3372D44E.5F44@sprintmail.com> <337813DF.598C@dynamite.com.au> X-Orig-Message-ID: <337a3e4b.779495@news.airmail.net> Organization: INTERNET AMERICA NNTP-Proxy-Relay: library.airnews.net Newsgroups: comp.lang.ada Date: 1997-05-14T00:00:00+00:00 List-Id: Alan Brain wrote: >Kevin Cline wrote: > >> I didn't say you would RETURN a reference to a container. >> I said you would pass one. > >> In C++, you would write something like: >> >> void Read_File_Lines(vector& lines, istream& in) > >And in Ada-83 even, you just pass the parameter as an _in out_ , which >compilers will pass by reference rather than value. > >You lose a bit in safety (forex the array being passed may be >unitialised, so may contain random garbage, which if read inside the >procedure will cause interesting results), but gain in efficiency, it's >a judgement call that will depend on circumstances. > This is useless when the size of the array required is computed inside the function. Some kind of dynamic data structure is required to write this code with reasonable efficiency.