[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC warning for qr.cc
From: |
Jaroslav Hajek |
Subject: |
Re: GCC warning for qr.cc |
Date: |
Wed, 18 Feb 2009 08:48:46 +0100 |
On Wed, Feb 18, 2009 at 8:44 AM, John W. Eaton <address@hidden> wrote:
> I'm seeing the following warning from gcc:
>
> src/DLD-FUNCTIONS/qr.cc:745: warning: suggest parentheses around && within ||
>
> The code is:
>
> 740 static
> 741 bool check_qr_dims (const octave_value& q, const octave_value& r,
> 742 bool allow_ecf = false)
> 743 {
> 744 octave_idx_type m = q.rows (), k = r.rows (), n = r.columns ();
> 745 return ((q.ndims () == 2 || r.ndims () == 2 && k == q.columns ())
> 746 && (m == k || (allow_ecf && k == n && k < m)));
> 747 }
>
> Is this check correct? Shouldn't Q and R both always be required to
> have 2 dimensions?
>
> In any case, I'd like to minimize possible confusion by adding some
> parens to make the intent clear and avoid the warning.
>
> Thanks,
>
> jwe
>
Yeah, the first || should be &&. No need for extra parens, then.
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz