Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2023-01

star operator on enum types

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Giuliano Colla

I found in a fpc program a statement sort of:

Type
   TSomeType = (a,b,c)
   TaType = set of TSometype
var
   setA,setB: TaType;
.....
*if setA * setB = [] then doSomething*;

which I found very smart to detect if the two sets have some common elements, but I've been unable to find in the fpc documentation how the
* operator is overloaded in fpc when dealing with enumerated and sets of enumerated types. Should I find out by trial and error or it's written somewhere?

Thanks,

Giuliano

Do not do to others as you would have them do to you.They might have different tastes.

Reply by email

Sven Barth
to Giuliano Colla

Giuliano Colla via fpc-pascal schrieb am
Do., 26. Jan. 2023, 18:43:

Show quoted text 15 lines
I found in a fpc program a statement sort of: Type TSomeType = (a,b,c) TaType = set of TSometype var setA,setB: TaType; ..... *if setA * setB = [] then doSomething*; which I found very smart to detect if the two sets have some common elements, but I've been unable to find in the fpc documentation how the * operator is overloaded in fpc when dealing with enumerated and sets of enumerated types. Should I find out by trial and error or it's written somewhere?

You are operating on *sets*, not enums. Thus you need to look at the documentation about set operators:
https://www.freepascal.org/docs-html/current/ref/refsu49.html#x156-18000012.8.6

Regards,
Sven

Reply by email

Giuliano Colla
to Sven Barth

Il 26/01/2023 18:52, Sven Barth via fpc-pascal ha scritto:

Show quoted text 28 lines
Giuliano Colla via fpc-pascal < > schrieb am Do., 26. Jan. 2023, 18:43: I found in a fpc program a statement sort of: Type   TSomeType = (a,b,c)   TaType = set of TSometype var   setA,setB: TaType; ..... *if setA * setB = [] then doSomething*; which I found very smart to detect if the two sets have some common elements, but I've been unable to find in the fpc documentation how the * operator is overloaded in fpc when dealing with enumerated and sets of enumerated types. Should I find out by trial and error or it's written somewhere? You are operating on *sets*, not enums. Thus you need to look at the documentation about set operators: https://www.freepascal.org/docs-html/current/ref/refsu49.html#x156-18000012.8.6 Regards, Sven

Thanks a lot,

Giuliano

Reply by email