How to iterate initialized enumerated types with Delphi 6 and avoid the “out of bounds” error?
问题 I am using Delphi 6 Professional. I am interfacing with a DLL libraty that declares an enumberated type as follows: TExtDllEnum = (ENUM1 = $0, ENUM2 = $1, ENUM3 = $2, ENUM4 = $4, ENUM5 = $8, ENUM6 = $10); As you can see the initialized values are not contiguous. If I try to iterate the type using a for loop as follows: var e: TExtDllEnum; begin for e := Low(TExtToDllEnum) to High(TExtToDllEnum) do ... // More code end; Delphi still increments e by 1 each loop invocation and thereby creates