Jump to content
  • Advertisement
Sign in to follow this  

Array doesn't properly document find and findByRef

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



It doesn't document that for find and findByRef "-1" means "not found".


Also using signed int's -1 is quite a bad kludge because it means you sacrifice 50% of the value range for a single option.

Also since the array uses uint length it won't be able to return anything above signed int's max value.


A better solution is to use uint max value (in C++ it can be represented by uint -1). This way there's 1 value to 1 option match up, there's no performance trade-off, and it's possible to address all indexes - 1.

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!