On 11/08/2022 13:38, Juha Manninen via fpc-devel wrote:

      // An empty string and the enum's unit name happen in gaps
      // of a non-contiguous enum. Why the unit name? A bug in FPC code?
  with GetTypeData(EnumType)^ do
    for I := MinValue to MaxValue do begin
      s := GetEnumName(EnumType, I);

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 ...
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to