[Developers] return_arrays_increment();

Arni Magnusson arnima at hafro.is
Fri Sep 11 10:59:22 PDT 2009


Modellers would be very grateful if they wouldn't have to do this kind of 
low-level housekeeping. Do you think it would be feasible to make tpl2cpp 
insert

   RETURN_ARRAYS_INCREMENT();

and

   RETURN_ARRAYS_DECREMENT();

automatically into the C++ source code, if the return value is of 
dvariable type? This would make ADMB code clearer and much more robust to 
user mistakes.

In terms of backward compatibility, does anyone know if it would be okay 
to repeat the "protective braces" like this,

   RETURN_ARRAYS_INCREMENT();
   RETURN_ARRAYS_INCREMENT();
   // code
   RETURN_ARRAYS_DECREMENT();
   RETURN_ARRAYS_DECREMENT();

in case the user has also included them in the TPL?

Arni



On Fri, 4 Sep 2009, Richard Methot wrote:

> There is no mention of this return_arrays queue issue in the ADMB 
> manual. Is there any reason for this being specific to AUTODIF?
>
> Rick
>
>
>
> John Sibert wrote:
>
>> Dave provides the "bullet proof" solution. Look near page 3-7 in the 
>> AUTODIF manual.
>>
>> John
>>
>>
>>
>> dave fournier wrote:
>>
>>> In this case you can get rid of the error in this way but as I already 
>>> said in general you should read about
>>>
>>>    return_arrays_increment();
>>>    return_arrays_decrement();
>>>
>>> if you have functions that return a dvariable object.
>>
>


More information about the Developers mailing list