Thomas Keller wrote: > I don't think [that no actual promotion to int need be done]. > One of the nicest things about C is that it generally doesn't > do things behind your back. If you want a type cast or > promotion in C, you have to do it explicitly, IIRC.
Then Royce Pereira wrote: > I'm still convinced that only the end result should be the > same as if the promotion had been done. I don't understand why this issue keeps coming up and doesn't get resolved the way the volatile thing does. I don't think I'm the best person to explain this, but maybe I can try and someone will correct me. The C standard describes the effect of language statements in terms of a "virtual machine". For example, in the virtual machine a char object must be promoted to an int object before performing arithmetic. The actual implementation may deviate from the precise behavior of the virtual machine, as long as the results are indistinguishable from those of the virtual machine at certain points in the program execution called sequence points (this is where I most expect to be corrected). Simplistically, sequence points occur between statements. So, the promotion can be optimized away as long as when the statement is done you can't tell the difference. Royce is right. (The volatile qualifier is actually closely tied to this because it imposes additional constraints on the optimizer such as keeping the exact same number of accesses to the object as appear in the source code.) Graham. _______________________________________________ AVR-GCC-list mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
