Jump to content
  • Advertisement
Sign in to follow this  
void0

re-initializing static variables

This topic is 4870 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

Maybe a dumb question; but is there a way to re-initialize static variables? I have this right now, and it's not pretty:
static double start = timeGetTime();
if (start == -1) start = timeGetTime();

Share this post


Link to post
Share on other sites
Advertisement
As far as i am aware you use static variables like any other, the static keyword simply means that it is initialised to zero and the typical other functonality.

ace

Share this post


Link to post
Share on other sites
I meant static in the context of a function.

I have a hard-coded animation where this function is called during the animation loop, but I want the static variable reset after the animation is done to prepare for the next animation.

Share this post


Link to post
Share on other sites
Alright, thanks. Would be nice to use "delete" or something so the variable gets initialized next time the function is called :) oh, well...

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!