[Developers] return_arrays_increment();

Arni Magnusson arnima at hafro.is
Tue Sep 15 10:22:37 PDT 2009


I appreciate your thoughts on this, Dave.


> Well it is not just a matter of sticking a
>
>  RETURN_ARRAYS_DECREMENT();
>
> at the end of the function because there may be a complicated set of 
> returns in the function.

You mean that there might be "if (A) then return X" in the middle of the 
function, and then "return Y" much later, at the end of the function? I'm 
not sure how to code that with a dvariable function. Is it:

FUNCTION dvariable f
   RETURN_ARRAYS_INCREMENT();
   // ...
   RETURN_ARRAYS_DECREMENT();
   if (A) return X;
   RETURN_ARRAYS_INCREMENT();
   // ...
   RETURN_ARRAYS_DECREMENT();
   return Y;

That rule might be almost as complicated to explain to users, as it is to 
take care of it in tpl2cpp. That is my question, at least.



> However the entire return arrays construction is probably not needed any 
> more.  Compiler optimization may have made it redundant and even 
> inefficient. You should keep in mind that the code was designed to run 
> on the first Borland Turbo C++ compiler with 640K under DOS in 1990.

You mean that the linad99/gradstrc.cpp definition of void 
RETURN_ARRAYS_INCREMENT(void) and void RETURN_ARRAYS_DECREMENT(void) could 
be simplified? My understanding of Kasper's example is that the return 
arrays construction is still needed.



> There are a number of areas where it really shows its age.

ADMB is still the best tool for fitting large models, and I'm confident it 
will improve with age. I anticipate that once the source is opened, the 
developer team will have a busy time sorting out code patches contributed 
by users, many of whom know C++ much better than I do. (And hopefully some 
that know flex.)


Arni


More information about the Developers mailing list