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 B9C4BA0547; Fri, 12 Mar 2021 18:06:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36BFA1608C6; Fri, 12 Mar 2021 18:06:02 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C33281608C0 for ; Fri, 12 Mar 2021 18:05:59 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 02ECD209B35E; Fri, 12 Mar 2021 09:05:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 02ECD209B35E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1615568759; bh=QaOWaTSobeoGOrHHmqoE/6dInYps3OBrliZXMDjTXtE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XWXenfdytBoJNbLl9d74dOnySDv5sGf327pAqFYWf4/X7PSnZGsE928cJZzOZyLRd tz6pu2cg9x+VGAS3eSviksGZ16sraNWPOjb7HjxOsPYScuCMMwBR+Ja+N/mDRLLSGz Mx2yPoZ5PqPj/haXmBS3ElZdWuH+/xKwv5mLXBDc= Date: Fri, 12 Mar 2021 09:05:58 -0800 From: Tyler Retzlaff To: "Burakov, Anatoly" Cc: dev@dpdk.org, david.hunt@intel.com Message-ID: <20210312170558.GA8084@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1615333490-15243-1-git-send-email-roretzla@linux.microsoft.com> <9ab8e965-b2ec-d554-d167-e3ed62ed62de@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ab8e965-b2ec-d554-d167-e3ed62ed62de@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 12:51:46PM +0000, Burakov, Anatoly wrote: > On 09-Mar-21 11:44 PM, Tyler Retzlaff wrote: > >use ~0ULL instead of -1ULL to avoid contridctory application of '-' sign > >to integer literal where the desired type is unsigned. > > > >Signed-off-by: Tyler Retzlaff > >--- > > 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. thanks! > > -- > Thanks, > Anatoly