Search Linux Wireless

Re: [PATCH] B43: misplaced parentheses?

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

 



On Sunday 15 February 2009 18:05:52 Larry Finger wrote:
> Roel Kluin wrote:
> > -			  | (rfatt->with_padmix) ? txctl_value : 0);
> > +			  | (rfatt->with_padmix ? txctl_value : 0));
> 
> As I see it, the difference between the above two lines is the same as the
> difference between c and d in this program:
> 
> int main(int argc, char **argv)
> {
>         int a = 1, b = 2, c, d;
> 
>         c = (a) ? b : 0;
>         d = (a ? b : 0);
>         fprintf (stderr, "a, b, c, d: %d %d %d %d\n", a, b, c, d);
>         return 1;
> }
> 
> When this program is executed, the output line is
> 
> a, b, c, d: 1 2 2 2
> 
> which is what I expected. Thus "(condition) ? result1 : result2" is the same as
> "(condition ? result1 : result2)".

The problem is the binary OR operator, which has precedence over the ?: operator.


-- 
Greetings, Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux