Netdev List
 help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@inai.de>
To: simran singhal <singhalsimran0@gmail.com>
Cc: pablo@netfilter.org, outreachy-kernel@googlegroups.com,
	Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	"David S. Miller" <davem@davemloft.net>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netfilter: ipset: Use max macro instead of ternary operator
Date: Tue, 28 Mar 2017 16:03:09 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LSU.2.20.1703281555450.21255@n3.vanv.qr> (raw)
In-Reply-To: <20170328133256.GA24590@singhal-Inspiron-5558>

On Tuesday 2017-03-28 15:32, simran singhal wrote:

>This patch replaces ternary operator with macro max as it shorter and
>thus increases code readability.
>
>-	return (ret < 0 ? 0 : ret);
>+	return max(0, ret);

While the two are functionally equivalent, "max" conveys a meaning of 
"upper bound" (think ceil(3)), i.e. a _count of something_, but the 
function still returns a logical "error or bool".

Such a change may be usable in an IOCCC or a codegolf contest,
but it destroys rather than improves readability IMHO.

  reply	other threads:[~2017-03-28 14:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 13:32 [PATCH] netfilter: ipset: Use max macro instead of ternary operator simran singhal
2017-03-28 14:03 ` Jan Engelhardt [this message]
2017-03-28 14:13 ` David Laight

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

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

  git send-email \
    --in-reply-to=alpine.LSU.2.20.1703281555450.21255@n3.vanv.qr \
    --to=jengelh@inai.de \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pablo@netfilter.org \
    --cc=singhalsimran0@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox