Link to home
Start Free TrialLog in
Avatar of PMH4514
PMH4514

asked on

Question on #define values

I'm looking at some code, this is purely an example, but I see often things like this:

-----------------------------
#define WRITEMODE_TRACKATONCE         0x00
#define WRITEMODE_DISCATONCE          0x01
#define WRITEMODE_DISCATONCE_RAW      0x02
#define WRITEMODE_SESSIONATONCE       0x03
#define WRITEMODE_PACKET_VARIABLE     0x04
#define WRITEMODE_PACKET_FIXED        0x05

#define DISCTYPE_CDR                  0
#define DISCTYPE_CDRW                 1
#define DISCTYPE_DDCDR                2
#define DISCTYPE_DDCDRW               3
#define DISCTYPE_DVDR                 4
--------------------------------------


that's from a CD write/read library.. My question is, why are constants defined at times like 0x02  and at other times, 2 (for example) What is the fundamental difference and when choosing to go with an 0x type value, from where to do you define the values??
thanks
-paul
ASKER CERTIFIED SOLUTION
Avatar of Member_2_1001466
Member_2_1001466

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PMH4514
PMH4514

ASKER

yeah, I realize they are hex representation.. I just wasn't sure why you'd choose one defintion over the other.  the intent to test bit combinations makes perfect sense.

thanks!
-Paul