Is any other way to compare 2 TGUID elements, except transform them into strings (the guidtostring function) and after evaluate the expression, in Delphi 7?
Delphi 7 tguid compare
You can use IsEqualGUID API declared in SysUtils.
IsEqualGUID() (or IsEqualIID()), like TOndrej suggested. You can also use SysUtuils. CompareMem() instead, since TGuid is a binary array of bytes.
As a side note: A GUID is NOT an array of bytes, it is a packed structure with DWORDS, WORDS and BYTES with a total length of 16 bytes. You can lookup the structure by checking out the TGUID type. –
Skipton
My point was that it is a fixed-length binary data type without any padding, so CompareMem() will work as an alternative to IsEqualGUID(), ie:
CompareMem(@Guid1, @Guid2, SizeOf(TGuid))
. –
Hampstead ... and
CompareMem()
seems to be slightly faster. –
Weikert © 2022 - 2024 — McMap. All rights reserved.