Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Message appear on top
Message
From
08/12/2005 05:49:34
 
 
To
08/12/2005 05:19:26
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01075298
Message ID:
01076055
Views:
16
Hi,


"His code is not formally wrong. Bitwise constants like this can be, and are, added together all the time. If I had the K&R C book handy I'd point you to some examples."
"this book is wrong."

it depends on the defined constants if one has to use BITOR or just can add (+) them.

e.g.
#DEFINE myDef1 0x01
#DEFINE myDef2 0x02
#DEFINE myDef3 0x04
? myDef1+myDef2+myDef3 = BITOR(myDef1,myDef2,myDef3) && .T.

#DEFINE myDef4 0x01
#DEFINE myDef5 0x02
#DEFINE myDef6 0x03 && not a power of 2, this makes problems
? myDef4+myDef5+myDef6 = BITOR(myDef4,myDef5,myDef6) && .F.
so the bottomline is - if all constants are powers of 2 one can also just add them, if not BITOR has to be used.

Regards
Christian
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform