comp.lang.ada
 help / color / mirror / Atom feed
From: anon@att.net
Subject: Re: If a routine should return two results, how should it be done?
Date: Sun, 27 Jul 2014 11:59:28 +0000 (UTC)
Date: 2014-07-27T11:59:28+00:00	[thread overview]
Message-ID: <lr2piv$ec2$1@speranza.aioe.org> (raw)
In-Reply-To: lr0qb7$549$1@speranza.aioe.org

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 <lr0qb7$549$1@speranza.aioe.org>, Victor Porton <porton@narod.ru> 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

      parent reply	other threads:[~2014-07-27 11:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-26 18:00 If a routine should return two results, how should it be done? Victor Porton
2014-07-26 18:53 ` Niklas Holsti
2014-07-26 18:57   ` Victor Porton
2014-07-26 19:21     ` Peter Chapin
2014-07-26 19:37       ` Dan'l Miller
2014-07-26 20:10     ` Shark8
2014-07-26 20:42 ` Victor Porton
2014-07-26 20:44   ` Victor Porton
2014-07-27 11:59 ` anon [this message]
replies disabled

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