Jump to content
  • Advertisement
Sign in to follow this  
luasitdown

D3DXVECTOR3 TO bool

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

Advertisement
Quote:
Original post by luasitdown
void foo(D3DXVECTOR v)
{
}

foo(false); // this pass compiler and work. why??


I make a mistake.

question is :

void far(bool b)
{
}

far(D3DXVECTOR3(0,0,0));
It work . why?

Share this post


Link to post
Share on other sites
D3DXVECTOR3 has an implicit conversion operator operator FLOAT *(). FLOAT * has an implicit conversion to bool based on whether or not it is null.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
D3DXVECTOR3 has an implicit conversion operator operator FLOAT *(). FLOAT * has an implicit conversion to bool based on whether or not it is null.


How to forbid the default cast? it make something under unkonwn, it easy to make bug.

Share this post


Link to post
Share on other sites
You can hack the headers to remove the implicit conversion or you can use a D3DVECTOR3, which lacks the C++ member functions.

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!