Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Apr 2001 21:55:11 -0400 (EDT)
From:      "T. William Wells" <bill@twwells.com>
To:        dillon@earth.backplane.com (Matt Dillon)
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: ntpd patch
Message-ID:  <E14lLSx-000Ei4-00@twwells.com>
In-Reply-To: <200104060056.f360uCN35967@earth.backplane.com> from "Matt Dillon" at Apr 05, 2001 05:56:12 PM

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E14lLSx-000Ei4-00>