[fpc-devel] Gaps in a non-contiguous enum

Martin Frb lazarus at mfriebe.de
Thu Aug 11 20:31:00 CEST 2022

On 11/08/2022 18:11, Juha Manninen via fpc-devel wrote:
> The MaxValue is used in many places for enum and set properties while 
> GetEnumNameCount() is not used anywhere.
> There are other similar bugs. At least these 2 in propedits.pp look fishy:
> - procedure TSetPropertyEditor.GetProperties
CompType of a set is an enum, so yes => GetEnumNameCount

> - subfunction IsPropInSet under function IsInteresting
seems the same

> OK, it was not a bug in FPC code. Sorry.

fpc code is still "unexpected".

It takes into account the MinValue

type TMyEnum = (a=5, b=7);

GetEnumName(pt, 5) // a
GetEnumName(pt, 6) // b // should be 7

if it is just the nth name, then it should start at 0 (or if needs be at 1).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20220811/0e7de1a7/attachment.htm>

More information about the fpc-devel mailing list