From owner-freebsd-bugs@FreeBSD.ORG Wed Jan 26 10:08:44 2005 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BCD4416A4CE for ; Wed, 26 Jan 2005 10:08:44 +0000 (GMT) Received: from ppsw-5.csi.cam.ac.uk (ppsw-5.csi.cam.ac.uk [131.111.8.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73E6B43D31 for ; Wed, 26 Jan 2005 10:08:44 +0000 (GMT) (envelope-from sos22@cantab.net) Received: from hermes-1.csi.cam.ac.uk ([131.111.8.51]:42665 helo=archibold.nowhere) by ppsw-5.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.155]:25) with smtp id 1Ctk6K-0004zr-Hv (Exim 4.44) (return-path ); Wed, 26 Jan 2005 10:08:40 +0000 Received: by archibold.nowhere (sSMTP sendmail emulation); Wed, 26 Jan 2005 10:08:39 +0000 Date: Wed, 26 Jan 2005 10:08:39 +0000 From: Steven Smith To: Giorgos Keramidas Message-ID: <20050126100839.GA4367@archibold> References: <20050125214606.GB1113@archibold> <20050126004033.GA2640@gothmog.gr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KsGdsel6WgEHnImy" Content-Disposition: inline In-Reply-To: <20050126004033.GA2640@gothmog.gr> X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ X-Cam-AntiVirus: No virus found X-Cam-SpamDetails: Not scanned cc: freebsd-bugs@freebsd.org cc: sos22@srcf.ucam.org cc: Steven Smith Subject: Re: Dubious #define in include/pwd.h X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2005 10:08:44 -0000 --KsGdsel6WgEHnImy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > I was messing around with sparse, the static checker used sometimes > > by Linux kernel people, and I (or rather, it) came upon the line > > > > #define _PW_VERSION_MASK '0xF0' > > > > in /usr/src/include/pwd.h. I can't immediately see any use for this; > > '\xf0' would probably be more useful. > If this is used as a mask for 'unsigned char' values, why would it make > any difference? Aren't they both going to be implicitly converted to > the right typep anyway? Well, except for the single quotes around '0xf0'. If you go: int x =3D '0xf0'; printf("%d\n", x); you probably won't get what you expect. If you replace the '0xf0' with '\xf0' you probably will. Steven. --=20 'Double-entry bookkeeping ....simple to adapt to modern computer methods by using positive or negative electric charges to signal whether an account should be debited or credited.' -- Accounting Theory and Practice, Glautier M.W.E --KsGdsel6WgEHnImy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFB92wnO4S8/gLNrjcRArpFAKCvm6+A0hCAwBMyDGYU48+rY+jdjwCfedPy keK6sQPcTpwFC8L21KUXr5o= =AlT+ -----END PGP SIGNATURE----- --KsGdsel6WgEHnImy--