From owner-freebsd-current Sun Feb 21 9:41:57 1999 Delivered-To: freebsd-current@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 9C74811CD6 for ; Sun, 21 Feb 1999 09:41:55 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.1/8.9.1) with ESMTP id JAA06507; Sun, 21 Feb 1999 09:35:40 -0800 (PST) (envelope-from jdp@polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.9.2/8.9.1) id JAA19103; Sun, 21 Feb 1999 09:35:40 -0800 (PST) (envelope-from jdp@polstra.com) Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <199902210846.AAA18860@apollo.backplane.com> Date: Sun, 21 Feb 1999 09:35:40 -0800 (PST) Organization: Polstra & Co., Inc. From: John Polstra To: Matthew Dillon Subject: Re: const char * Cc: current@FreeBSD.ORG, hibma@skylink.it Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Matthew Dillon wrote: >: >:In my opinion, the use of "-Wcast-qual" is bogus. Often the whole >:point of a cast is to remove a qualifier such as const. It's one >:thing to warn when that's done implicitly, and quite another thing >:to warn when the programmer has clearly expressed his intent through >:the use of a cast. > > There are only a few cases where cast-qual is bogus. 99% of > the warnings it generated were quite real. Maybe not bugs, but > definitely programming by misadventure. Volatile and const are > only going to become more important as we get deeper into the > SMP issues. Especially volatile. cast-qual is necessary to keep > people from making bozo mistakes. I would find -Wcast-qual tolerable if it behaved just a little bit differently. It should allow without complaint explicit casts which change _only_ the constness. For example, casting from "const char *" to "char *" explicitly would be OK. But casting from, say, "const char *" to "void *" would still produce a warning. This would make it possible to get rid of the warnings in those cases where it made sense to cast away const (e.g., dealing with bad but standard interfaces). The above is more or less how C++'s "const_cast(x)" construct works. John --- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Nobody ever went broke underestimating the taste of the American public." -- H. L. Mencken To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message