octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: surface cdata property restricted to double or uint8


From: Jaroslav Hajek
Subject: Re: surface cdata property restricted to double or uint8
Date: Mon, 30 Aug 2010 11:10:59 +0200

On Mon, Aug 30, 2010 at 7:34 AM, John W. Eaton <address@hidden> wrote:
> On 30-Aug-2010, Jaroslav Hajek wrote:
>
> | If I see right, however, you save the space for lda doubles, but there
> | are already two arrays of 3*lda doubles around (cmapv and av), which
> | means you'll save 14% memory at best. That is really not much in
> | Octave's context. I would likewise prefer the simpler change.
>
> OK, I checked in the following change.
>
>  http://hg.savannah.gnu.org/hgweb/octave/rev/56f9c10e9e98
>
> Note that instead of adding a constraints, I simply removed the
> existing constraints on the cdata and alphadata surface properties.
> Does anyone see a problem with doing that?
>
> jwe
>

After second glance, I see the following problem (not related to the
constraint removal, though):

const double *cv = cdata.array_value().data ();

is a bad idea, because array_value may (especially with the constraint
removed) create a temporary, which will be destroyed immediately after
the statement finishes, leaving cv to be a dangling pointer.
The correct way is:
http://hg.savannah.gnu.org/hgweb/octave/rev/015ba76371b9

regards

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]