Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Nov 2014 16:31:05 +0000
From:      Brooks Davis <brooks@freebsd.org>
To:        Dag-Erling Sm?rgrav <des@des.no>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" <bz@freebsd.org>, src-committers@freebsd.org, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: svn commit: r274340 - in head/sys: crypto/rijndael dev/random geom/bde
Message-ID:  <20141111163105.GA69731@spindle.one-eyed-alien.net>
In-Reply-To: <86oasd6dad.fsf@nine.des.no>
References:  <201411100944.sAA9icnN061962@svn.freebsd.org> <3C962D07-3AAF-42EA-9D3E-D8F6D9A812B0@FreeBSD.org> <86sihq5a2v.fsf@nine.des.no> <20141111223756.F3519@besplex.bde.org> <86oasd6dad.fsf@nine.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Nov 11, 2014 at 03:07:54PM +0100, Dag-Erling Sm?rgrav wrote:
> Bruce Evans <brde@optusnet.com.au> writes:
> > -Wcast-qual is not a very good warning option since the official way
> > to remove qualifiers in C is to cast them away.  Casting them away is
> > better than using the __DECONST() abomination.  The option exists
> > because it is too easy for sloppy code to cast away const without
> > really intending to or when casting away const is done intentionally
> > but is an error.
>=20
> I agree that __DECONST() is ugly (not least because it strips all
> qualifiers, not just const, so it should be DEQUAL()), but the
> alternative is worse.  In my experience, the majority of cases where a
> cast discards a qualifier are bugs, with struct iov being one of very
> few legitimate use cases.

On the processor we (SRI and Cambridge) are working on, pointers
are not integers (we support some integer behaviors, but not
pointer->int->pointer casts except in limited cases) and the current
__DECONST implementation will need to die[0].  For existing C versions
some sort of compiler support for __DECONST is probably the right thing
to do.  In general, we need to fix the C/C++ standard to us express the
things we actually mean when we use const (for example see strchr()'s
use of const).  I believe the last issue now being tracked on Google's
internal list of deficiencies in the C++ standard.

-- Brooks

[0] The recently discussed _ALIGN also needs to die and be replaced with
something that increments the pointer (or returns how much to increment)
rather than jamming it though a long.

--k+w/mQv8wyuph6w0
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlRiOcgACgkQXY6L6fI4GtTrRACfT999XBInar6dHmsmVrxRBx/f
BF8AoN9pD0cIDbQn+7wpgyBqyMI/mwZD
=qLQb
-----END PGP SIGNATURE-----

--k+w/mQv8wyuph6w0--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141111163105.GA69731>