unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH 3/8] CLI: replace some constructs with more uncrustify friendly ones
Date: Sun, 16 Jun 2019 13:09:47 -0400	[thread overview]
Message-ID: <87blyx1mp0.fsf@fifthhorseman.net> (raw)
In-Reply-To: <20190613110837.6256-4-david@tethera.net>

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

On Thu 2019-06-13 08:08:32 -0300, David Bremner wrote:
>    - add parens in some ternery operators

itym "ternary"

> @@ -120,13 +120,13 @@ _process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *
>  static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
>  {
>      return
> -	!!opt_desc->opt_inherit +
> -	!!opt_desc->opt_bool +
> -	!!opt_desc->opt_int +
> -	!!opt_desc->opt_keyword +
> -	!!opt_desc->opt_flags +
> -	!!opt_desc->opt_string +
> -	!!opt_desc->opt_position;
> +	(bool) opt_desc->opt_inherit +
> +	(bool) opt_desc->opt_bool +
> +	(bool) opt_desc->opt_int +
> +	(bool) opt_desc->opt_keyword +
> +	(bool) opt_desc->opt_flags +
> +	(bool) opt_desc->opt_string +
> +	(bool) opt_desc->opt_position;
>  }

i find this is deeply weird.  It looks like it is coercing various types
into bools, and then summing a list of bools.

While the spec might well say that the sum of two bools should be an int
(i haven't checked), it's not at all obvious to me that the infix +
operator should assume that type.  (float + float is a float, not an
int, for example)

in some sense, the !! operator works better here because i know that its
output is likely to be an int, so summing makes sense.

I can live with this if we need it for making uncrustify nicer, but i
just wanted to register that it looks to me like a regression in terms
of readability.

   --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2019-06-17  3:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 11:08 v2 uncrustify David Bremner
2019-06-13 11:08 ` [PATCH 1/8] STYLE: document rules for calls, block comments, ternary ops David Bremner
2019-06-13 11:12   ` David Bremner
2019-06-13 11:08 ` [PATCH 2/8] uncrustify: indent classes David Bremner
2019-06-13 11:08 ` [PATCH 3/8] CLI: replace some constructs with more uncrustify friendly ones David Bremner
2019-06-16 17:09   ` Daniel Kahn Gillmor [this message]
2019-06-17  5:01     ` David Bremner
2019-06-17 15:40       ` Daniel Kahn Gillmor
2019-06-13 11:08 ` [PATCH 4/8] cli: run uncrustify David Bremner
2019-06-13 19:52   ` Tomi Ollila
2019-06-14 10:30     ` David Bremner
2019-06-14 10:50       ` David Bremner
2019-06-13 11:08 ` [PATCH 5/8] util: " David Bremner
2019-06-13 11:08 ` [PATCH 6/8] compat: " David Bremner
2019-06-13 11:08 ` [PATCH 7/8] parse-time-string: " David Bremner
2019-06-13 11:08 ` [PATCH 8/8] lib: " David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blyx1mp0.fsf@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).