From owner-freebsd-bugs Thu Apr 5 18:55:41 2001 Delivered-To: freebsd-bugs@freebsd.org Received: from smtp.popsite.net (smtp.popsite.net [216.126.128.17]) by hub.freebsd.org (Postfix) with ESMTP id 7B0B737B43F for ; Thu, 5 Apr 2001 18:55:39 -0700 (PDT) (envelope-from bill@twwells.com) Received: from twwells.com (02-104.051.popsite.net [64.24.21.104]) by smtp.popsite.net (Postfix) with ESMTP id 3F271508FE for ; Thu, 5 Apr 2001 20:55:26 -0500 (CDT) Received: from bill by twwells.com with local (Exim 3.22 #1) id 14lLSx-000Ei4-00; Thu, 05 Apr 2001 21:55:11 -0400 Subject: Re: ntpd patch To: dillon@earth.backplane.com (Matt Dillon) Date: Thu, 5 Apr 2001 21:55:11 -0400 (EDT) Cc: freebsd-bugs@freebsd.org In-Reply-To: <200104060056.f360uCN35967@earth.backplane.com> from "Matt Dillon" at Apr 05, 2001 05:56:12 PM X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: From: "T. William Wells" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The correct code for dealing with a plain char pointer is: isspace(*(unsigned char *)ptr); 1) Though the defined type may, in fact, be a character, we are treating it as an unsigned character and this code makes that explicit. 2) This code works on ones complement machines; (unsigned char)*ptr does not. 3) This code has a better chance of generating decent code when optimization is turned off. (unsigned char)*ptr has an implicit conversion to int, then the explicit conversion to unsigned char, followed by an implicit conversion to unsigned int. *(unsigned char *)ptr has only the implicit conversion to an unsigned int. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message