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

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Thu, 27 Oct 2016 12:46:47 +0200

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.

Heyho Anselm,

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.

--Markus
Received on Thu Oct 27 2016 - 12:46:47 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 27 2016 - 12:48:17 CEST