What is the most concise yet readable way to check whether a GUID is zero? I have come up with the following code:
GUID myGuid /* = ... */ ;
GUID zeroGuid;
memset(&zeroGuid, 0, sizeof(zeroGuid));
if (!IsEqualGUID(myGuid, zeroGuid))
{
// ... do something if GUID is not zero ...
}
But I think above code is too clumsy. Of course, I could define my own IsZeroGUID() function, but I guess that there already is built-in function in C++.
Is there a better 开发者_如何转开发way?
Compare with GUID_NULL
:
if( myGuid != GUID_NULL ) {
//do stuff
}
myGUID == zeroGUID
should do the trick.
精彩评论