<div dir="ltr"><div class="gmail_extra">On Mon, Apr 1, 2013 at 9:40 AM, Juan Jose Garcia-Ripoll <span dir="ltr"><<a href="mailto:juanjose.garciaripoll@gmail.com" target="_blank">juanjose.garciaripoll@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I know, but I do not have C++11 in all the machines I work with.</blockquote>
</div><br>Despite this, I have managed to advance a bit without cluttering the code too much. A few tenths of lines more and the interface can now handle functions with reference arguments, working as SBCL does: the I/O arguments are returned as extra return values.<br>
<br>An example of the code that can be written is below. Still, there are things to be handled, like functions with void return values, but a minimal portable and very understandable interface can be built using Christian's idea</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">An excerpt of test/test_defun.cc<br><br clear="all"><div><div> int f_int_int_ref(int &i) {</div><div> int output = i + 1;</div><div> i = i + 2;</div>
<div>
return output;</div><div> }</div><div><br></div><div> TEST(Defun, DefunIntRef1) {</div><div style> /* Defines a function that returns two values: "output"</div><div style> * and the value of the reference. */</div>
<div> defun("FOO", f_int_int_ref);</div><div> ASSERT_T(eval_string("(EQUAL (MULTIPLE-VALUE-LIST (FOO 0)) '(1 2))"));</div><div> ASSERT_T(eval_string("(EQUAL (MULTIPLE-VALUE-LIST (FOO 1)) '(2 3))"));</div>
<div> ASSERT_T(eval_string("(EQUAL (MULTIPLE-VALUE-LIST (FOO 2)) '(3 4))"));</div><div> }</div></div><div><br></div>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br>
<a href="http://juanjose.garciaripoll.googlepages.com" target="_blank">http://juanjose.garciaripoll.googlepages.com</a>
</div></div>