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=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: If a routine should return two results, how should it be done? Date: Sun, 27 Jul 2014 11:59:28 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: Reply-To: anon@att.net NNTP-Posting-Host: 5gPy4UMVqyTrHviwt7a6gw.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: IBM NewsReader/2 2.0 Xref: news.eternal-september.org comp.lang.ada:21279 Date: 2014-07-27T11:59:28+00:00 List-Id: You forgot one: 2.A function with one or more "in" argument(s) that are pointers. 1. Procedure is the normally way to handle "out" arguments in all Ada. And as of Ada 2012 it just one way. 2. As for the function with or or more "out" arguments. The only advantage is for interfacing to C routines and libraries. Else, it not very useful. One reason is in some cases the compiler can generate more code to handle the new function design then a procedure. 2.A. As for function with one or more "in" pointer type of argument(s), it just bad programming and the compiler should check and report is design as an error. 3. As for result being a record type. It just a standard result of some function. In , Victor Porton writes: >If a routine should return two results, how should it be done? > >1. procedure with two out arguments; > >2. function with one out argument; > >3. create specific record type for the result type of the function? > >What are advantages and disadvantages of each variant? > >-- >Victor Porton - http://portonvictor.org