[fpc-pascal] Element type of set at compile time

Michael Van Canneyt michael at freepascal.org
Sun May 15 17:40:13 CEST 2022



On Sun, 15 May 2022, Martin Frb via fpc-pascal wrote:

> On 15/05/2022 15:07, Hairy Pixels via fpc-pascal wrote:
>> var
>>    I: ElementType(TMySet);
>> begin
>>    for i := low(TMySet) to high(TMySet) do
>>      ;
>>
> type
>   TMySet = set of (one,two,three);
> var
>   I: low(TMySet) .. high(TMySet) ;
> begin
>   for i := low(TMySet) to high(TMySet) do
>     ;
type
   TMySet=set of (one,two,three);
var
   I:low(TMySet)..high(TMySet);

begin
   for i:=low(TMySet) to high(TMySet) do
    writeln(i);
end.

prints indeed

one
two
three

Michael.


More information about the fpc-pascal mailing list