Delphi 7 tguid compare
Asked Answered
E

2

10

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?

Eschatology answered 25/10, 2010 at 7:25 Comment(0)
M
26

You can use IsEqualGUID API declared in SysUtils.

Micrography answered 25/10, 2010 at 7:42 Comment(0)
H
5

IsEqualGUID() (or IsEqualIID()), like TOndrej suggested. You can also use SysUtuils. CompareMem() instead, since TGuid is a binary array of bytes.

Hampstead answered 25/10, 2010 at 23:57 Comment(3)
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.