This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: c++/5089: -Wold-style-cast warns about cast to void
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: jturner <jturner at mail dot alum dot rpi dot edu>
- Cc: nathan <nathan at gcc dot gnu dot org>, gcc-gnats <gcc-gnats at gcc dot gnu dot org>, gcc <gcc at gcc dot gnu dot org>, law <law at gcc dot gnu dot org>, dosreis <dosreis at cmla dot ens-cachien dot fr>
- Date: Sun, 30 Dec 2001 16:17:33 +0000
- Subject: Re: c++/5089: -Wold-style-cast warns about cast to void
- Organization: Codesourcery LLC
- References: <200112292031.AA203227448@mail.alum.rpi.edu>
Jeffrey Turner wrote:
> >This question came up recently on a gcc mailing list.
> >Is there a C++ way to cast something to a void?
You're missing the point. No one claimed that static_cast<void> (foo)
was wrong. The problem is
a) the assert macro
b) static_cast<void> (foo) is a mouthful which obscures what you're trying
to do. thinks: why am I ignoring the result of a static_cast?, oh I
see the target type is void. Much more up front is to have the 'void'
at the start of the expression. void is a singularity in the type system,
and I beleive -Wold-style-cast should treat it as such.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org