This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]