• Advertisement
Sign in to follow this  

D3DXVECTOR3 TO bool

This topic is 4385 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
Guessing, I would say that D3DXVECTOR is a pointer. false == 0 == NULL, and NULL is a valid pointer address.

Share this post


Link to post
Share on other sites
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