[Developers] Is this what we want?

dave fournier davef at otter-rsch.com
Wed Dec 12 17:22:01 PST 2012


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