You are here: Re: Function returning 2 arrays - which way to do so? « PHP Programming Language « IT news, forums, messages
Re: Function returning 2 arrays - which way to do so?

Posted by Tim Roberts on 01/08/08 06:23

Logos <tyler.style@gmail.com> wrote:
>
>I'll second this one. Passing in both arrays by reference is clean &
>tidy, and a commonly accepted way for a function to 'return' more than
>one value.

That's true in C and C++, but only because there's no way to return several
things at once.

There are two issues with the reference solution. First, it requires the
caller to allocate arrays first, and then pass those arrays to the
function. In many cases, that's not natural. Second, it creates a high
degree of linkage between the callee and caller, which again may not be
natural.

Now, these are both highly philosophical issues, but there is good sense in
adapting a policy that things to be returned should always be "returned",
rather than by modifying in/out parameters.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация