Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jun 2001 10:09:43 -0400 (EDT)
From:      "T. William Wells" <bill@twwells.com>
To:        roam@orbitel.bg (Peter Pentchev)
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: free() and const warnings
Message-ID:  <E158MxL-0004BT-00@twwells.com>
In-Reply-To: <20010608155527.D7671@ringworld.oblivion.bg> from "Peter Pentchev" at Jun 08, 2001 03:55:28 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> Errrr.. this was the whole point of this thread.  I *can't* cast
> a (const char *) to a (char *) when using the -Wcast-qual gcc flag -

Not all -W options are equally useful and some are actively harmful.

This is one of them. There are several situations where it is
necessary to remove a qualifier (any code for strchr, e.g.).
Adding nonportable hacks to your code to avoid a gcc error message
is just plain bad coding.

Perhaps gcc has a way to turn off warnings temporarily; I haven't
checked lately. If not, roll your own. Define a comment like
/*CASTOK*/, to stick on each line with such a cast, then filter
the gcc output using a script that examines the source code for
such comments and removes the bogus error messages.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E158MxL-0004BT-00>