[fpc-pascal] Ordinal casting to enums

Ondrej Pokorny lazarus at kluug.net
Thu Jun 6 09:33:15 CEST 2024


On 06.06.2024 09:19, Ondrej Pokorny via fpc-pascal wrote:
> writeln() converts the ordinal value to the value name and if the 
> entry is not found, the 107 error is raised.
>
> Ondrej
>
> On 06.06.2024 06:22, Hairy Pixels via fpc-pascal wrote:
>> [ ... ]
>> how this works at runtime is another question.

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

Ondrej



More information about the fpc-pascal mailing list