Dear all,
I made a mistake...
I wrote code like following...
FAILED_RETURN(hr = CopyPEFiles(bCopyPEFiles));
The definition of FAILED_RETURN is
#define FAILED_RETURN(hr) { if(FAILED(hr)) { _ASSERT(FALSE); return hr; } }
Guess what?
The macro is expended like:
{if(FAILED(hr = HPCopyPEFiles(bCopyPEFiles)) {_ASSERT(FALSE); return hr = HPCopyPEFiles(bCopyPEFiles);}
Oops! CopyPEFiles() are entered twice !!!!
The correct code should be:
hr = CopyPEFiles(bCopyPEFiles);
FAILED_RETURN(hr);
Putting an expression in parameter list of a function may be safe,
but it MUST BE dangerous in a macro !!!
No comments:
Post a Comment