From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 19:11:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71CF91065674 for ; Sun, 25 Jan 2009 19:11:30 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id E64C68FC2A for ; Sun, 25 Jan 2009 19:11:25 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 25 Jan 2009 19:11:24 -0000 Received: from p54A3D748.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.215.72] by mail.gmx.net (mp014) with SMTP; 25 Jan 2009 20:11:24 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX18+9t4768U+tknva/4Q0jKPzgRTYo3bC6X67PVSdn yFEimtQQ+Y8h+j Message-ID: <497CB95A.109@gmx.de> Date: Sun, 25 Jan 2009 20:11:22 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Jeff Roberson References: <200901251838.n0PIcgXk024858@svn.freebsd.org> <20090125085419.O983@desktop> In-Reply-To: <20090125085419.O983@desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 Cc: svn-src-head@freebsd.org, Jeff Roberson , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187693 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 19:11:30 -0000 Jeff Roberson schrieb: > On Sun, 25 Jan 2009, Jeff Roberson wrote: > >> Author: jeff >> Date: Sun Jan 25 18:38:42 2009 >> New Revision: 187693 >> URL: http://svn.freebsd.org/changeset/base/187693 >> >> Log: >> - bit has to be fd_mask to work properly on 64bit platforms. Constants >> must also be cast even though the result ultimately is promoted >> to 64bit. >> - Correct a loop index upper bound in selscan(). > > Sorry about that, should've tested my earlier patch for more than a > couple of days. I seldom remember c's integer promotion rules as they > relate to constants. You'd think they'd make it easy on us and just > promote it to the largest type in the expression/lvalue. I'm not sure > why they don't. Perhaps the more careful among you knows the answer. The rule for operations is quite simple: An operation never cares for the type of its user. It only uses the type of the operand(s) to determine its result type. So for a = b + c the type of the result of + only depends on the types of b and c, but never on a. Integer literals have a bit ugly rules what type they are: It depends on the base (!) and on the magnitude of the literal. If in doubt and you need a specific type (and maybe making it more clear for a reader) then cast.