开发者

How to check whether GUID is zero

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜