Re: [hackers] [dwm] [PATCH] get rid of unnecessary ternary operator

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Thu, 27 Oct 2016 13:57:51 +0200

On 27 October 2016 at 12:46, Markus Teich <markus.teich_AT_stusta.mhn.de> wrote:
> Anselm R Garbe wrote:
>> To me ! is logical NOT and your suggestion relies on the fact that
>> XUrgencyHint is a single bit flag? no?
>>
>> I prefer the original code, as it doesn't use side effects of logical NOTs.
>
> The `(wmh->flags & XUrgencyHint)` is used as a bool value regardless. Basically
> `test_exp ? 1 : 0` seemed stupid to me. The double negation achieves the same
> thing as having the `? 1 : 0` (normalizing the output). However your argument
> with using the side effects of ! are valid, so leave it as it is.

Exactly, I prefer the original version.

Cheers,
Anselm
Received on Thu Oct 27 2016 - 13:57:51 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 27 2016 - 14:00:27 CEST