From owner-freebsd-bugs Thu Apr 5 21:44:56 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 7FFEC37B443 for ; Thu, 5 Apr 2001 21:44:54 -0700 (PDT) (envelope-from bill@twwells.com) Received: from twwells.com (01-036.051.popsite.net [64.24.21.36]) by smtp.popsite.net (Postfix) with ESMTP id F4050508D7 for ; Thu, 5 Apr 2001 23:44:35 -0500 (CDT) Received: from bill by twwells.com with local (Exim 3.22 #1) id 14lO5a-000Iy9-00; Fri, 06 Apr 2001 00:43:14 -0400 Subject: Re: ntpd patch To: dillon@earth.backplane.com (Matt Dillon) Date: Fri, 6 Apr 2001 00:43:14 -0400 (EDT) Cc: freebsd-bugs@freebsd.org In-Reply-To: <200104060410.f364AmX37732@earth.backplane.com> from "Matt Dillon" at Apr 05, 2001 09:10:48 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 > I really doubt any FreeBSD utility would actually run on a 1's > complement machine anyway, so there is no particular reason to > try to support it, Odds are, this is true. OTOH, suppose someone else took up the patch and applied it elsewhere? It would be nice if it actually did work right. And, who knows? Maybe someone will try to port *BSD to a Univac someday. :) > try to support it, and gcc will have no problem optimizing > (unsigned char)*ptr verses *(unsigned char *)ptr... One would hope. > there is a very good chance that both would produce exactly the > same code as a result, even without using any optimization flags. > Casts are one of the easiest optimizations a C compiler can make. You'd think. However, back when I did a lot of portable programming, one thing I found is that compilers, especially when run without optimization, could produce some really gawdawful code. For example, I've seen (unsigned char)(int_expression) generate an 'and 0xFF' instruction whether it needs it or not. Just for amusement, I went ahead and looked to see what gcc (without optimization) would do. For my test case, the two produced identical code. But they both *also* generated code with a movl %eax,%eax that served absolutely no purpose at all. :) But really all that is beside the point -- the difference between the two is trivial to code and one *is* correct, both theoretically and practically, but the other only correct in practice -- today's practice that is. If it involved any significant effort to do it the completely correct way, I wouldn't be arguing the point. But since it doesn't.... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message