From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BBE63A0547; Fri, 12 Mar 2021 19:36:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 882EB1608D8; Fri, 12 Mar 2021 19:36:17 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 0BA6F1608D5 for ; Fri, 12 Mar 2021 19:36:16 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5D63820B39C5; Fri, 12 Mar 2021 10:36:15 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5D63820B39C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1615574175; bh=PSBxXUPoQ1RugC150QN8T9i2FKO6c9uDg8nT8mCZ0dU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bw22zhBfKfsxlglyuHVSZqhPzxB+nMZD0IXydSeDAbDDiHxvrLmSYJnLq+05ydc5m kJ6yVgqKyb81wNkqJ9L7rj3cRo2fDpW45fTBFB8hnRGKPxYkQnM2oKNB4onTmFUVgV jQtNZ2Am+ZCDFCjBmO/oHOH4AXWym/rvwEyy+W2Y= Date: Fri, 12 Mar 2021 10:36:15 -0800 From: Tyler Retzlaff To: Bruce Richardson Cc: "Burakov, Anatoly" , dev@dpdk.org, david.hunt@intel.com Message-ID: <20210312183615.GA23744@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1615333490-15243-1-git-send-email-roretzla@linux.microsoft.com> <9ab8e965-b2ec-d554-d167-e3ed62ed62de@intel.com> <20210312170558.GA8084@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20210312173741.GC937@bricha3-MOBL.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210312173741.GC937@bricha3-MOBL.ger.corp.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [dpdk-dev] [PATCH] eal, power: don't use '-' sign with unsigned literals X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Mar 12, 2021 at 05:37:41PM +0000, Bruce Richardson wrote: > On Fri, Mar 12, 2021 at 09:05:58AM -0800, Tyler Retzlaff wrote: > > > Not sure i agree. It's a very common pattern and is widely used and > > > understood. I mean, if anything, seeing `~0` would have me stop and > > > think as i've literally never seen such code before. > > > > it produces warnings under some compilers. in some enterprises we are > > required to fix certain classes of warnings (not suppress them from the > > command line) as a function of security policies. > > > > as an alternative would you be more willing to accept something like the > > following? ``(unsigned long long)-1LL'' if you don't like ``~0ULL'' it > > would make explicit what the compiler is already doing. > > > > the issue is the application of the sign to what is clearly something not > > signed; it get's flagged. so the cast is an explicit expression of intent > > that will not generate the warnings. > > > > appreciate you're help in finding a solution even if it isn't the > > proposed solution. > > > What about using ULLONG_MAX and similar defines from limits.h? i think this would be okay even in circumstances where the code is building masks so long as in practice it results in "all bits being set". i'm not aware of a XXX_MAX where max isn't all bits set.. is there?