octave-maintainers
[Top][All Lists]
Advanced

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

Re: fix null assignment


From: Jaroslav Hajek
Subject: Re: fix null assignment
Date: Mon, 22 Sep 2008 13:42:26 +0200

On Sat, Sep 20, 2008 at 4:32 PM, John W. Eaton <address@hidden> wrote:
> On 20-Sep-2008, John W. Eaton wrote:
>
> | Please take a look at the two sets of diffs below.
> |
> | The first set of changes seem to have the desired effect, but I'm not
> | entirely happy with them.
>
> If you are interested in experimenting with these changes, please use
> the following version of the first patch instead.
>
> Thanks,
>
> jwe
>
>

Close enough for government work, I guess, but still looks a bit
dirty. The special check in assign is not immediatelly obvious, and it
does not catch the more obscure cases like `b{1} = []; a = ones(3);
a(1:2,:) = b{1}'. The problem is that not all octave_value assignments
happen through octave_value:assign.

The first attached patch (on top of your first one) hacks two more
places to prevent a null matrix from being stored anywhere,
encapsulating the hack in a member function.
(empty

You may also consider the second patch. It avoids using the extra bool
flag in Array.h by introducing a special static member for null
matrices.

I can't say I like this solution. I like my idea with op_nul_asn_eq
better. Still, this one is here and is working, it's a solution, while
my idea is just an idea. I guess I can attend to it in the future.

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

Attachment: empty-assign-diffs-1.1.diff
Description: Text Data

Attachment: empty-assign-diffs-1.2.diff
Description: Text Data


reply via email to

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