Neil Williams <[EMAIL PROTECTED]> writes: >> They should always be specified as based off some constant identifier, >> rather than a particular value. I'm not sure what you mean. > > Why? This probably sounds obvious to you but if new identifiers are expected > to be based on QOF_DEFAULT_LIMIT + n, then I need to ensure this assumption > is in the API docs because it certainly would not be obvious to me. I expect > it's just something you've covered elsewhere that I haven't anticipated but > I'd like to be sure. (Blame it on me being self-taught.)
Events should always be a power of 2. This way bitmasking events works quickly and efficiently. It does, however, limit the number of events you can have. >> > I thought nobody wanted to iterate over event identifiers? >> >> I have no idea how that relates to this...? > > I thought you were using the << operator to create some way of iterating > through the list of available event identifiers somewhere but couldn't see > why. Derek's pointer to bitmasking cleared that up. No, << operator is just a bit-shift operation. The construct: 1 << x Is a way to make a set of bitmasks. One suggestion I had was to do something like: #define QOF_MAKE_EVENT(x) (1<<x) Then you can do: #define QOF_EVENT_A QOF_MAKE_EVENT(0) #define QOF_EVENT_B QOF_MAKE_EVENT(1) ... and then in the API code: #define APP_EVENT_A QOF_MAKE_EVENT(QOF_EVENT_BASE+0) #define APP_EVENT_B QOF_MAKE_EVENT(QOF_EVENT_BASE+1) ... -derek -- Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory Member, MIT Student Information Processing Board (SIPB) URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH [EMAIL PROTECTED] PGP key available _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel