Hello all,

Another Question on C/C++, Please be patient just learning.

Example from Palm OS Bible librarian sample.

librarianDB.c

// Utility macros for handling bit fields

#define BitAtPosition(pos) ((UInt16)1 << (pos))

#define GetBitMacro(bitfield, index) ((bitfield) & BitAtPosition(index))

#define SetBitMacro(bitfield, index) ((bitfield) |= BitAtPosition(index))

#define RemoveBitMacro(bitfield, index) ((bitfield) &= 
~BitAtPosition(index))

Here's the question in my newfound C speak;

if ((#define BitAtPosition(pos) ((UInt16)1 << (pos))) == ("Sets a 16 bit 
bitmask with (pos)")) {

   " Why not declare bitmap constants?";

    "Is there a performance issue?";

    a memory space issue?;

    "Or just to avoid constants for the many flags in this app?";

  }

else {

  "Did I miss the whole point of the Macro?";

"I hope not given the time it took to come up with the interpretation";

}



Thanks again, Gary



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to