Are you sure TRUE is defined as 1? I know in MFC it is, but I've seen implementations that use the definition
#define FALSE 0
#define TRUE (!FALSE)
I don't see how this could be the cause of your problem, but it might add to it. Also, have you checked the type BOOL is in fact defined as int and not overwritten by some old header? Wouldn't be the first time I've seen conflicting macro definitions... You could of course overcome such issues by explicitely defining an int variable that holds the intended value:
void SetOrder(BOOL bOrder) {
int iOrder(bOrder?1:0);
_itot_s(iOrder, ...
P.S.: I just checked the definition of the not operator '!', and it appears my above example
#define TRUE (!FALSE)
would in fact result in the definition
#define TRUE true
(provided you have a modern C++ compiler that supports the type bool). In a context that requires an int, true would be converted to 1 as required by the standard, so the concern I brought up can in fact not be a problem at all, and my workaround is uncalled for.
modified on Friday, April 1, 2011 10:41 AM