octave-maintainers
[Top][All Lists]
Advanced

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

Re: proposal: avoid potential leakage in src/ov-base-mat.h


From: Jaroslav Hajek
Subject: Re: proposal: avoid potential leakage in src/ov-base-mat.h
Date: Sat, 22 Jan 2011 09:20:24 +0100

On Sat, Jan 22, 2011 at 8:56 AM, John W. Eaton <address@hidden> wrote:
> On 21-Jan-2011, CdeMills wrote:
>
> | introducing an operator= in octave_base_matrix to avoid potential leakage.
> | Indeed, the memory pointed by typ and idx_cache should be released before
> | being assigned another value.
>
> I agree that it would be better to prevent a potential leak.  But I
> think that assigning an octave_base_matrix object would be a misuse of
> the class, so it would be better to prevent that than to allow
> assignment.  If you'd like, submit a patch that enforces this by
> adding private assignment operators to these classes.
>

I agree with John. These objects should be exclusively dynamically
allocated and serve mostly as wrappers for liboctave objects. While
copy constructors make sense for most of them (for implementing
clone()), assignment operators are useless. Perhaps even the copy
ctors could be made private.


reply via email to

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