Ordering of return values in C++ files

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Ordering of return values in C++ files

Rik-4
12/9/11

John,

I believe you mentioned at some point that the following construction

retval(1) = xxx;
retval(0) = yyy;

is preferable to

retval(0) = yyy;
retval(1) = xxx;

because octave_value_list will only be sized once.  Is my memory correct?

If this is true then there are 51 instances of the bad pattern which would
be trivial to fix.

Cheers,
Rik
Reply | Threaded
Open this post in threaded view
|

Ordering of return values in C++ files

John W. Eaton
Administrator
On  9-Dec-2011, Rik wrote:

| 12/9/11
|
| John,
|
| I believe you mentioned at some point that the following construction
|
| retval(1) = xxx;
| retval(0) = yyy;
|
| is preferable to
|
| retval(0) = yyy;
| retval(1) = xxx;
|
| because octave_value_list will only be sized once.  Is my memory correct?

Yes, because octave_value_list is implemented with an
Array<octave_value> internally.

| If this is true then there are 51 instances of the bad pattern which would
| be trivial to fix.

OK, fixing that would be fine with me.

Thanks,

jwe