Archived

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

"FAILED(ddrval)" or "ddrval==DD_OK"

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

Yes, FAILED and SUCCEEDED are preferred over checking against DD_OK, or S_OK. This is because it is possible for COM interfaces to return multiple success values.

Share this post


Link to post
Share on other sites
Using the FAILED/SUCCEEDED macros is definitely the preferred method. I've occasionally heard the argument that they are slower than the check for == DD_OK; however, here's the definition of the macros:

code:

#define SUCCEEDED(Status) ((HRESULT)(Status) >= 0)
#define FAILED(Status) ((HRESULT)(Status)<0)

Since macros are inserted before compilation, there shouldn't be any speed decrease doing it this way.

- Dave

Share this post


Link to post
Share on other sites
I havnt had any instances, but is 'FAILED(ddrval)' better to use than 'ddrval == DD_OK" when checking for DirectX return errors?

Share this post


Link to post
Share on other sites