[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
f(end) feature?
From: |
John W. Eaton |
Subject: |
f(end) feature? |
Date: |
Tue, 31 Dec 2002 14:16:14 -0600 |
On 31-Dec-2002, Paul Kienzle <address@hidden> wrote:
| octave:1> function y=f(x), y=x; end
| octave:2> f(end)
| ans = 1
Try the following patch. With it, you should see
octave:1> function y = f (x) y = x; end
octave:2> f (end)
error: invalid use of end
error: evaluating argument list element number 1
jwe
2002-12-31 John W. Eaton <address@hidden>
* pt-arg-list.cc (F__end__): Fail if rows or columns is negative.
Index: pt-arg-list.cc
===================================================================
RCS file: /usr/local/cvsroot/octave/src/pt-arg-list.cc,v
retrieving revision 1.12
diff -u -r1.12 pt-arg-list.cc
--- pt-arg-list.cc 21 Dec 2002 17:15:25 -0000 1.12
+++ pt-arg-list.cc 31 Dec 2002 20:15:07 -0000
@@ -104,7 +104,15 @@
{
case -1:
// XXX FIXME XXX -- we really want "numel" here.
- retval = indexed_object->rows () * indexed_object->columns ();
+ {
+ int nr = indexed_object->rows ();
+ int nc = indexed_object->columns ();
+
+ if (nr < 0 || nc < 0)
+ ::error ("invalid use of end");
+ else
+ retval = nr * nc;
+ }
break;
case 0:
- f(end) feature?, Paul Kienzle, 2002/12/31
- f(end) feature?,
John W. Eaton <=
- Re: f(end) feature?, Paul Kienzle, 2002/12/31
- Re: f(end) feature?, John W. Eaton, 2002/12/31
- Re: f(end) feature?, Paul Kienzle, 2002/12/31
- Re: f(end) feature?, John W. Eaton, 2002/12/31
- Re: f(end) feature?, Paul Kienzle, 2002/12/31
- Re: f(end) feature?, John W. Eaton, 2002/12/31