[fpc-pascal] Sets as array index?

Jürgen Hestermann juergen.hestermann at gmx.de
Tue Oct 15 07:10:43 CEST 2013

Am 2013-10-12 14:07, schrieb Jürgen Hestermann:
 > I want to do something like this (which is not directly possible but maybe by some other way?):
 > I := TagArray[TagSet];
 > I := TagArray[[tag1,tag5]];
 > or
 > I := TagArray[ord(TagSet)];
 > I := TagArray[ord([tag1,tag5])];
 > I think that the compiler somehow needs to generate the bit mask for [tag1,tag5]
 > internally anyway so maybe it's available by some function to the programmer?

First: Why does it take 3 days until my mail arrives in the list?

Second: I already found out myself how to do what I want:

I := TagArray[byte(TagSet)];
I := TagArray[byte([tag1,tag5])];

Although, when extending the set above 8 elements
I manually need to change it to

I := TagArray[word(TagSet)];
I := TagArray[word([tag1,tag5])];

More information about the fpc-pascal mailing list