Quote: "No, it's not. The operator precedence is ambiguous here"
I knew there was a reason I used the second one.
Quote: "The ORing is a bitwise operation and, from my perspective, performs faster than the addition operation. The lack of parenz is because the shift operator binds more closely than the OR operator and thus assures that all the shift operations are performed before the OR."
I simply find it clearer to use +'s. That was my point.
Quote: "When both, or others, can be passed to a function together you can pass them combined, yes, by addition. However, more often than not you'll see them passed in combination as:
Control (MOTOR_ON | LIGHT_ON);"
For controlling variables/registers, that is the way to go. For instance, when writing programs for the GameBoyAdvance, this sort of thing is common.
#define REG_DISPCNT (*(volatile uShort*)0x4000000)
#define MODE_1 0x0001
#define MODE_2 0x0002
#define MODE_3 0x0003
#define MODE_4 0x0004
#define MODE_5 0x0005
#define BACKBUFFER 0x0010 //bit 4
#define BG0_ENABLE 0x0100 //bit 8
#define BG1_ENABLE 0x0200 //bit 9
#define BG2_ENABLE 0x0400 //bit 10
#define BG3_ENABLE 0x0800 //bit 11
int main ( )
{
//Video Mode 4 and BG2 enabled.
REG_DISPCNT = MODE_4 | BG2_ENABLE;
//Switch to back buffer before drawing.
REG_DISPCNT ^= BACKBUFFER;
gui4::guiBorderedBox ( 10, 10, 220, 50, 1 );
//Switch back to front buffer.
REG_DISPCNT ^= BACKBUFFER;
return;
}
Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo