Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Message appear on top
Message
De
08/12/2005 05:49:34
 
 
À
08/12/2005 05:19:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01075298
Message ID:
01076055
Vues:
15
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform