char a;
char b;
char c;
a = b + c;
a = (char)((int)b+(int)c);
In the first line it’s implict conversion from char to int. In the second line it’s explicit. Is there a difference in the binary file generated by compiler?
Please consider this question from embedded systems perspective.
My reading of the standard suggests that this is left up to the implementation and the optimizer.
Section 5.1.2.3, part 10:
My understanding is that the standard lets the compiler decide if it is OK to use 8-bit addition, as long as the result is not going to be distinguishable from the addition of ints and converted to chars.
NOTE Back at my days in the embedded world (mid-nineties), the C compiler that we used for our 8-bit platforms, Whitesmith compiler for 68HC11, produced a “plain” 8-bit addition instruction for adding two
chars. The only way to find out for sure what happens in your fujitsu system would be to compile-to-assembly and check for yourself.