In my Direct3D application, instead of using the defensive if(FAILED(...))), I decided to use assert(...). This worked great for me in debug mode. However, as someone pointed out to me, ''...'' won''t get called in the release build because assert gets compiled out.
Well, they''re obviously right. Is there a version of assert that is made for defensively calling functions, not calling a function on the return type and asserting the return type? If not, is there source code to assert, or an assert-like function?
Or should I just bite the bullet and declare a glocal HRESULT and do something like:
assert(hr=g_pd3d->CreateDevice());
Or I could also just do something like:
#define Assert(exp) (HRESULT hr; assert(hr=exp))
What do yo guys think is the best way of going about this?
Thanks!