[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c"
From: |
Gerard Jungman |
Subject: |
Re: [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c" |
Date: |
Wed, 23 Apr 2008 15:19:55 -0600 |
On Wed, 2008-04-23 at 15:14 +0100, Brian Gough wrote:
> I've played with a few variations and found that the alternative
>
> for (i = N; i-- > 0;)
Bah. I would just use the simple version he suggests
> > for (i = 0; i < N; i++) { j = N - i; ... }
The extra variable is perfectly reasonable.
> I never really liked code that depends on the distinction between --i
> and i--, being burned a few times by subtle bugs from not noticing the
> wrong one being used, hence the tendency to write things like i>0 &&
> i--.
I agree. The simple version is the best though.
--
G. Jungman
- [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c", Kort Travis, 2008/04/20
- Re: [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c", Julian Seward, 2008/04/20
- Re: [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c", Andrew W. Steiner, 2008/04/20
- Re: [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c", Julian Seward, 2008/04/22
- Re: [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c", Brian Gough, 2008/04/23
- Re: [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c",
Gerard Jungman <=
- Re: [Bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c", Julian Seward, 2008/04/24