From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.redhat.com (Postfix) with ESMTP id B9C30434F6 for ; Fri, 8 Nov 2002 19:42:28 -0500 (EST) Received: (from mail@localhost) by int-mx1.corp.redhat.com (8.11.6/8.11.6) id gA90gS305250 for axp-list@listman.redhat.com; Fri, 8 Nov 2002 19:42:28 -0500 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id gA90gSf05246 for ; Fri, 8 Nov 2002 19:42:28 -0500 Received: from ellpspace.math.ualberta.ca (ellpspace.math.ualberta.ca [129.128.207.67]) by mx1.redhat.com (8.11.6/8.11.6) with SMTP id gA90Jcw03735 for ; Fri, 8 Nov 2002 19:19:38 -0500 Received: (from michal@localhost) by ellpspace.math.ualberta.ca (8.11.6/8.11.6) id gA90gTh05727 for axp-list@redhat.com; Fri, 8 Nov 2002 17:42:29 -0700 Date: Fri, 8 Nov 2002 17:42:29 -0700 From: Michal Jaegermann To: axp-list@redhat.com Subject: Re: [PATCH] eliminate compile warnings Message-ID: <20021108174229.B5518@ellpspace.math.ualberta.ca> References: <20021106214705.A15525@Marvin.DL8BCU.ampr.org> <02110709222600.14483@shadowfax.middleearth> <20021107202855.B17028@Marvin.DL8BCU.ampr.org> <20021107173349.A4017@twiddle.net> <20021108073845.A17905@Marvin.DL8BCU.ampr.org> <20021108102823.A4439@ellpspace.math.ualberta.ca> <20021108215056.C18411@Marvin.DL8BCU.ampr.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20021108215056.C18411@Marvin.DL8BCU.ampr.org>; from dl8bcu@dl8bcu.de on Fri, Nov 08, 2002 at 09:50:56PM +0000 X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: On Fri, Nov 08, 2002 at 09:50:56PM +0000, Thorsten Kranzkowski wrote: > > if you will try to _reduce_ number of casts by making sure that types of > > objects agree, if only possible, instead of sprinkling code with extra > > I've actually done that. You mean in a version you are working on now? There was quite a few extra casts in what I have seen. Some of them appeared "obviously correct" but this was not the case for others. > > But if you want a unsigned constant with all bits on then ~0UL is surely > > preferable over casting (-1) to unsigned long; even if just for clarity. > > ok, what do you suggest when there's a > return ( x ? 0 : -ENOMEM ) > in a function declared as unsigned long ? I noticed this in a patch for setup.c: - if (bootmap_start == -1) { + if (bootmap_start == (unsigned long)-1L) { What I meant that it seems that you really wanted here if (bootmap_start == ~0UL) { I did not check if there are other spots of that sort. If you refer to what displeased Richard then if a return value from arch_get_unmapped_area_1() is abused to return also an error code of 'int' type then a cast to (unsigned long), i.e. to what is returned but not to (unsigned), on -ENOMEM could be the only sane way out. If -ENOMEM is really an 'int' constant then likey you could get away with 'if ((int)addr != -ENOMEM)' but this is abusing what we know about expected bit patters which can result from a call to arch_get_unmapped_area_1() and I do not think that taking such risks is a correct way to do it. Michal