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 34F49A0547; Fri, 12 Mar 2021 19:40:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C275D1608D8; Fri, 12 Mar 2021 19:40:03 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 17AB31608D5 for ; Fri, 12 Mar 2021 19:40:02 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 6769C209B340; Fri, 12 Mar 2021 10:40:01 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6769C209B340 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1615574401; bh=cNd9+cq+hfet/1BMwSF77Z34sqtlQYNDm6tFO5/Eyls=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J7nZKWnFvmVvd70JMbizuvxnmmovMNK17Q7uo75Ygq1v5WBgoTY8vBeRriepxxqSV XlL0OX0Z3IaZiko5EmpCrOEm2Vl6tEDVPO1MRbZMdN+4kJhehpCrE0LPrVX1Of1uov hi5udiohehSMlyn/YWChAnCG0jNxZDyi3xanmnjU= Date: Fri, 12 Mar 2021 10:40:01 -0800 From: Tyler Retzlaff To: Bruce Richardson Cc: "Burakov, Anatoly" , dev@dpdk.org, david.hunt@intel.com Message-ID: <20210312184001.GB23744@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> <20210312183615.GA23744@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210312183615.GA23744@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> 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 10:36:15AM -0800, Tyler Retzlaff wrote: > 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? just a qualification to my previous. specifically for the UXXX_MAX (unsigned) preprocessor definitions, we aren't talking about signed here (or at least i wasn't).