Re: [hackers] [slock] [PATCH] Refactor main()

From: FRIGN <dev_AT_frign.de>
Date: Mon, 22 Aug 2016 09:37:15 +0200

On Mon, 22 Aug 2016 09:30:29 +0200
Anselm R Garbe <garbeam_AT_gmail.com> wrote:

Hey Anselm,

> First, why using
>
> /*
> * tiny comment
> */
>
> instead of
> /* tiny comment */

that is definitely a style matter, but it serves to provide a hierarchy
for comments. Of course, if you wish, I can change this accordingly.

> Second, why introducing superfluous scope brackets?
>
> I prefer
>
> if (!(dpy = XOpenDisplay(0)))
> die("cannot open display\n");
>
> to cumbersome:
>
> if (!(dpy = XOpenDisplay(NULL))) {
> die("slock: cannot open display\n");
> }

It saves one line to leave the brackets out, but it has happened to me
more than once that people add a line to the if clause not paying
attention and effectively introducing a bug. And FWIW, in my opinion,
having brackets improves readability a bit.
But again, if it is your explicit desire, I can create a version of the
patch with the brackets removed.

Cheers

FRIGN

-- 
FRIGN <dev_AT_frign.de>
Received on Mon Aug 22 2016 - 09:37:15 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 22 2016 - 09:48:15 CEST