Char constants (literals like 'a') are of type long, not int
Brought to you by:
jmarshall
I stumbled upon the following problem:
#define sprintf StrPrintF
A code like this:
sprintf(x, "%c", intval ? '1' : '0'); DOESN'T WORK,
while
sprintf(x, "%c", (int)(intval ? '1' : '0')); WORKS.
(where x is an initialized char*)
StrPrintF declaration is seen by the compiler before
it is used, so this behaviour is incorrect. '1' and
'0' must be automatically converted to int.
Logged In: YES
user_id=4669
True. For now, put the cast in. This is on the list for
fixing when we update to GCC 3.x, but I don't want to do it
twice, which is what would happen if we did it now. See
also
http://www.escribe.com/computing/pcpqa/m18245.html