[Developers] Is this what we want?

John Sibert sibert at hawaii.edu
Wed Dec 12 18:11:52 PST 2012


OK. I did consider the possibility that it might be a good thing. Thanks 
for clarifying.
John

John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa

Visit the ADMB project http://admb-project.org/

On 12/12/2012 03:22 PM, dave fournier wrote:
> On 12-12-12 04:53 PM, John Sibert wrote:
>
> I think you are thinking about it wrong.  The idea was that you can have
> say a ragged dmatrix with possibly  unallocated rows.  When you read 
> or write
> an unallocated row nothing happens.  This is the right behaviour 
> because there
> is nothing there. Totally Zen man.
>
>
>> While perusing some code this morning I came across the following in 
>> tools99/ad_cif.cpp
>>
>> cifstream& cifstream::operator>>(const dvector& z)
>> {
>>   if (allocated(z))
>>   for (int i= z.indexmin(); i <= z.indexmax(); i++)
>>   {
>>     *this >> z[i];
>>   }
>>   return *this;
>> }
>>
>> If I'm reading this correctly, if memory for the dvector z is 
>> allocated the for loop is executed changing the elements of z (in 
>> spite of the const keyword). On the other hand if z is not allocated, 
>> the stream pointer is simply returned to whatever called the operator 
>> and the elements of z are not changed.
>>
>> This is the correct action if z in not allocated, but should there be 
>> a warning or an error exit?
>>
>> Cheers,
>> John
>>
>
>



More information about the Developers mailing list