Closed 4Luke4 closed 5 years ago
You are getting the operator precedence wrong. You need parentheses around the BAND/BOR expression:
((flags BAND original_class_thief) == original_class_thief)
You are getting the operator precedence wrong. You need parentheses around the BAND/BOR expression:
((flags BAND original_class_thief) == original_class_thief)
Yes, you're right. Shouldn't WeiDU throw some sort of warning in such cases?
This is equivalent to 2 * 4 + 2 = 12
. If you expect the result to be 12, you need parentheses around the addition, because it has lower precedence than multiplication. There's no way for WeiDU to know whether 10 or 12 is the result you expect. But I can agree the precedence order is unintuitive.
This is equivalent to
2 * 4 + 2 = 12
. If you expect the result to be 12, you need parentheses around the addition, because it has lower precedence than multiplication. There's no way for WeiDU to know whether 10 or 12 is the result you expect. But I can agree the precedence order is unintuitive.
Is this related to the difference between Regular Grammars and CF Grammars (i.e., rigid linear structure vs. tree-like structure)?
I wouldn't think so. The precedence order seems to be a holdover from when C was designed. TP2 kind of just went along with it, I suppose.
https://stackoverflow.com/questions/4685072/operator-precedence-bitwise-lower-than
So, if you execute the following block
you'll fail to patch only dual-classed thieves (original class: Thief). For instance, you'll patch WIVEN.cre (whose set flags are BIT0, BIT24 and BIT26). I suspect BAND being broken.....
The same holds if you use BOR: