[5.40 beta 1] EnumerationBinary

Everything else that doesn't fall into one of the other PB categories.
Little John
Addict
Addict
Posts: 4869
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

[5.40 beta 1] EnumerationBinary

Post by Little John »

Observation 1

Code: Select all

EnumerationBinary 0
  #a
  #b
  #c
EndEnumeration  

Debug #a
Debug #b
Debug #c
Output is
0
0
0
but I would expect as output
0
1
2
Observation 2

Code: Select all

EnumerationBinary 5
  #a
  #b
  #c
EndEnumeration  

Debug #a
Debug #b
Debug #c
Output is
5
10
20
Is this actually intended? Does it make sense?
Or should the compiler generate an error message such as "The start constant of EnumerationBinary must be a multiple of 2."?
Fred
Administrator
Administrator
Posts: 18538
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [5.40 beta 1] EnumerationBinary

Post by Fred »

Yes, it should be a multiple of 2 as it's meant to create 'flag' like enumeration easily. Also, setting 0 as start values makes no sens as 0 will be always wrong when testing with the '&' operation. I will add a compiler check to catch those, thank you.
Little John
Addict
Addict
Posts: 4869
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: [5.40 beta 1] EnumerationBinary

Post by Little John »

Fred wrote:Also, setting 0 as start values makes no sens as 0 will be always wrong when testing with the '&' operation.
Yes, I see now. Thanks for the explanation.
Post Reply