Re: [dev] [PATCH] [slock] rework setting window color

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Tue, 12 May 2015 00:46:46 +0200

Dimitris Papastamos wrote:
> On Fri, May 08, 2015 at 06:13:21PM +0200, Markus Teich wrote:
> > + color = len ? INPUT : (failure || failonclear ? FAILED : INIT);
>
> I would split this condition out. Looks good for the rest.

Heyho,

I think it is pretty readable for a nested ?: operator:

- Not used in a functioncall, just a simple assignment.
- The nested one is in the false part.
- No inversions or calculations.

Splitting it into something like the following doesn't seem easier to grasp:

        color = INPUT;
        if (!len)
                color = failure || failonclear ? FAILED : INIT;

or

        color = failure || failonclear ? FAILED : INIT;
        if (len)
                color = INPUT;

If there are no other strong arguments against it, I would like to keep it as
proposed.

--Markus
Received on Tue May 12 2015 - 00:46:46 CEST

This archive was generated by hypermail 2.3.0 : Tue May 12 2015 - 00:48:07 CEST