Page 1 of 1

[5.40 beta 1] EnumerationBinary

Posted: Mon Aug 31, 2015 4:24 pm
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."?

Re: [5.40 beta 1] EnumerationBinary

Posted: Mon Aug 31, 2015 5:32 pm
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.

Re: [5.40 beta 1] EnumerationBinary

Posted: Mon Aug 31, 2015 6:00 pm
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.