oh, it's writeln which is doing the runtime check, thanks. Doing math on enums is probably not a smart idea though. I wonder why a subscript like [] was never added to enums. It would be nice to do:
f := Fruit[banana.index + 1]; instead of dealing with raw values. A runtime check for creating enums was ordinals would be smart also, like: f := Fruit.Create(10); instead of blindly cast ordinals to enums which may be invalid. > On Jun 6, 2024, at 2:33 PM, Ondrej Pokorny <laza...@kluug.net> wrote: > > To find out, compile FPC with debug info and step into the writeln() call > with F7 (multiple times until you get into fpc_shortstr_enum_intern()): > > #0 FPC_SHORTSTR_ENUM_INTERN(4284424, 4284488, POINTER(nil), > POINTER($00326000), , 12) at sstrings.inc:575 > #1 fpc_write_text_enum(POINTER($00416008), POINTER($00416048), 0, TEXT (), > 12) at text.inc:1272 > #2 main at project1.lpr:16 Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal