Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Andrew Nguyen

Dynamic Variables

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

I''m thinking, is there a Dynamic Varible available? No.was the answer. Now, I have to say, they are useful. What is a dynamic variable you may ask, well, if i said: dynamic int a and a = (c/b), then if c and b bothe equaled 5, a would be 0 now, the computer only processess that once, but what if b or c changed? Well, with a dynamic variable, a would be constantly recalculated if b or c were constantly recalculated too.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by barazor
sounds alot like references
maybe
int &a = (c/b);
would work...not sure though


Blahh.. Maybe! I've got to test this out!



Edited by - MindFlayer on December 31, 2001 4:47:27 PM

Share this post


Link to post
Share on other sites
Maybe the only viable solution so far is Martee''s #define?

Your class would need to create a thread and periodically poll the values of variables it was assigned to monitor - useless overhead. If the variable was a symbolic alias (meaning that it was replaced by the actual values at compile time), then it would work but would introduce some new problems.

I think it''s easier to simply notify any "watcher" variables whenever code modifies a variable''s value.

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!