Jump to content
  • Advertisement
Sign in to follow this  
Alundra

Old unused variable trick for assert : sizeof

This topic is 978 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

An old trick was to use sizeof against cast-to-void for unused variable for assert to not have evaluation of the parameter.

Is it still valid nowadays or cast-to-void works on all case nowadays ?

Thanks

Edited by Alundra

Share this post


Link to post
Share on other sites
Advertisement

I use slightly different technique, 

 

void Foo(int /*SomeParameter*/)

 

This way, I get also quick documentation and shut up compiler warning.

Share this post


Link to post
Share on other sites
That does not really help for what was asked and what SeanMiddleditch described: the point is that the arguments are needed when the assert is evaluated.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!