c++/5089: -Wold-style-cast warns about cast to void

Nathan Sidwell nathan@codesourcery.com
Sun Dec 30 08:26:00 GMT 2001


The following reply was made to PR c++/5089; it has been noted by GNATS.

From: Nathan Sidwell <nathan@codesourcery.com>
To: jturner <jturner@mail.alum.rpi.edu>
Cc: nathan <nathan@gcc.gnu.org>, gcc-gnats <gcc-gnats@gcc.gnu.org>,
   gcc <gcc@gcc.gnu.org>, law <law@gcc.gnu.org>,
   dosreis <dosreis@cmla.ens-cachien.fr>
Subject: Re: c++/5089: -Wold-style-cast warns about cast to void
Date: Sun, 30 Dec 2001 16:17:33 +0000

 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



More information about the Gcc-prs mailing list