Microsoft VC6 has a 'bug', where post-increment behaviour can change in a macro, if optimisation set to \O2 (Maximise speed).
So when using macros with VC6, it is best to place all post-increment operations in a separate statement.
example:
#define MI_ADD_LONG_PARAM(PARAM_DIRECTION, VAR) \
_addLongParam(PARAM_DIRECTION, offsetof(SFINDMERCPARAMS, VAR), acDBBinding[iParamOrdinal - 1], iParamOrdinal++);
#define MI_ADD_LONG_PARAM(PARAM_DIRECTION, VAR) \
_addLongParam(PARAM_DIRECTION, offsetof(SFINDMERCPARAMS, VAR), acDBBinding[iParamOrdinal - 1], iParamOrdinal); \
iParamOrdinal++;
So when using macros with VC6, it is best to place all post-increment operations in a separate statement.
example:
#define MI_ADD_LONG_PARAM(PARAM_DIRECTION, VAR) \
_addLongParam(PARAM_DIRECTION, offsetof(SFINDMERCPARAMS, VAR), acDBBinding[iParamOrdinal - 1], iParamOrdinal++);
is best altered to be:
#define MI_ADD_LONG_PARAM(PARAM_DIRECTION, VAR) \
_addLongParam(PARAM_DIRECTION, offsetof(SFINDMERCPARAMS, VAR), acDBBinding[iParamOrdinal - 1], iParamOrdinal); \
iParamOrdinal++;
Comments
Post a Comment