octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random questions


From: Michael Goffioul
Subject: Re: Random questions
Date: Thu, 20 Dec 2012 15:33:37 -0500

On Thu, Dec 20, 2012 at 3:23 PM, John W. Eaton <address@hidden> wrote:
On 20-Dec-2012, Júlio Hoffimann wrote:

|     Could you give a specific example?
|
| static std::istringstream&
| single_num (std::istringstream& is, double& num) { //... }
|
| This `num' argument is supposed to be returned by the function.

There are two things that this function returns, the stream and the
number.  C++ functions can only return one value.  It makes more sense
to return the stream directly, so the other is returned by reference
in the argument list.

To be honest, it looks more like the reason is because it's standard practice when handling C++ iostream, as it allows to chain << and >> operators. But in this very specific case, the main return value doesn't seem to be used at all. And as the function is static, it's not being used anywhere else than in str2double.cc.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]