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]

FWD: Re: Your Message Sent on Sat, 29 Dec 2001 16:28:56 -0500


---------- Original Message ----------------------------------
From: Bjarne Stroustrup <bs@research.att.com>
Reply-To: Bjarne Stroustrup <bs@research.att.com>
Date:  Sat, 29 Dec 2001 16:51:06 -0500 (EST)


>Date: Sat, 29 Dec 2001 16:28:56 -0500
>Mime-Version: 1.0
>From: "Jeffrey Turner" <jturner@mail.alum.rpi.edu>
>To: <bs@day.research.att.com>
>
>Dear Mr. Stroustrup,
>
>This question came up recently on a gcc mailing list.
>Is there a C++ way to cast something to a void?
>Gcc will, reasonably enough give a warning for
>
>     (void) foo
>
>if "-Wold-style-casts" is in the command-line.
>Can it be done with <xxxxxxx_cast>s?

Sure:

	static_cast<void>(e);

is ok for any valid expression e. (standard 5.2.9[4])


>Thanks again,
>
>--Jeff Turner
>
>Who put the Sam in the "'Sama Laden Ding-Dong"?
>                 

	- Bjarne
Bjarne Stroustrup, http://www.research.att.com/~bs 


                 


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