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

From: Evan Gates <evan.gates_AT_gmail.com>
Date: Fri, 28 Oct 2016 10:37:29 -0700

On Fri, Oct 28, 2016 at 2:17 AM, Hiltjo Posthuma <hiltjo_AT_codemadness.org> wrote:
>
> FWIW: I disagree. The ternary form is slightly longer but more readable.

I too disagree. I think the !! is more readable and idiomatic (either
way, at least we aren't casting to bool...). But I am curious, does
the compiler still generate a branch for the ternary? How does the
code compare for the 3 cases? I'll play around with that later.

That being said, isurgent is being used in the traditional boolean
sense where 0 is false and non 0 is true. As such there is no need to
do either. Just having

    c->isurgent = wmh->flags & XUrgencyHint;

is fine.

emg
Received on Fri Oct 28 2016 - 19:37:29 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 28 2016 - 19:48:16 CEST