> On Sep 27, 2022, at 5:19 PM, Pierre Muller via fpc-pascal
> <[email protected]> wrote:
>
> TDiagnosticSeverity = ( NoError { will be 0},
> Error {will stay equal to 1},
> Warning {will stay equal to 2},
> Information {will stay equal to 3},
> Hint {will stay equal to 4}
> );
>
>
> Not a general solution, but a very simple one in that specific case!
I like that actually, thanks. There’s a number of these 1 indexed enums but I
think this trick will work in most cases.
I know some languages have the convention where you can set just the first
index of the first value to set the indexing. That would be a good feature to
add to Pascal so we can still publish the enums safely for APIs that have 1
indexing.
TDiagnosticSeverity = ( Error = 1,
Warning,
Information,
Hint
);
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal