BasePointer wrote:Interesting but, type casting worked. If so, I don't understand why the compiler doesn't generate same warning for other lines:*bcd++ = (tmp / 10) + '0';*bcd = (tmp % 10) + '0';If the right side of the equations are type int, shouldn't the compiler generate same warning?
It would appear that the addition of the character constant makes the intent clear to the compiler - remove the addition process and the C2705 warning will (re)appear.
Another possible issue for the first line may be -
Does the assignment of the value to the pointer location occur before or after the pointer is incremented?
I seem to recall having read that this cannot be guaranteed for pointers - but perhaps may not be correct. Others may be able to advise whether there is really an ambiguity or compiler dependency in this respect. I have usually thought it prudent to increment the pointer as a separate operation.
Regards,
Mac