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

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Fri, 28 Oct 2016 11:17:09 +0200

On Thu, Oct 27, 2016 at 12:41:25PM +0200, Laslo Hunhold wrote:
> On Thu, 27 Oct 2016 10:02:32 +0200
> Anselm R Garbe <garbeam_AT_gmail.com> 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.
>
> this is exactly what was checked with the ternary operator. The
> bitmask-result is also "so to say" casted to a boolean value, and
> !! is inverse-idempotent on booleans, which means that we are save
> here. I prefer Markus' approach, but it's your decision as a maintainer.
>

FWIW: I disagree. The ternary form is slightly longer but more readable.

-- 
Kind regards,
Hiltjo
Received on Fri Oct 28 2016 - 11:17:09 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 28 2016 - 11:24:14 CEST