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

Juha Manninen juha.manninen62 at gmail.com
Thu Aug 11 18:11:14 CEST 2022

On Thu, Aug 11, 2022 at 4:44 PM Martin Frb via fpc-devel <
fpc-devel at lists.freepascal.org> wrote:

> Because you are not supposed to use MaxValue
> Instead use  GetEnumNameCount
>      for I := MinValue to MinValue + GetEnumNameCount(...) - 1 do begin
> The unit name is returned because the TypeDate stores the unitname after
> the continuous list of element names. And once you are out of index ...

Damn, you are right. I fixed it better.
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
- subfunction IsPropInSet under function IsInteresting

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20220811/fc68b34f/attachment.htm>

More information about the fpc-devel mailing list