From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753104AbdC1OEP (ORCPT ); Tue, 28 Mar 2017 10:04:15 -0400 Received: from a3.inai.de ([88.198.180.161]:57798 "EHLO a3.inai.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbdC1ODs (ORCPT ); Tue, 28 Mar 2017 10:03:48 -0400 Date: Tue, 28 Mar 2017 16:03:09 +0200 (CEST) From: Jan Engelhardt To: simran singhal cc: pablo@netfilter.org, outreachy-kernel@googlegroups.com, Jozsef Kadlecsik , "David S. Miller" , 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 In-Reply-To: <20170328133256.GA24590@singhal-Inspiron-5558> Message-ID: References: <20170328133256.GA24590@singhal-Inspiron-5558> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.