Defect Report #070
Submission Date: 03 Dec 93
Source: Clive Feather
Item 7 - interchangeability of function arguments
Consider the following program:
void output (c)
printf("C == %d\n", c);
int main (void)
The constant 6 has type int, and 6U has type unsigned
int (subclause 184.108.40.206), and they have the same representation
(subclause 220.127.116.11). Footnote 16, which is not a part of the C Standard,
states that this implies that they are interchangable as arguments.
However, int and unsigned int are not compatible types,
and so subclause 18.104.22.168 makes the second call undefined.
Is the program strictly conforming?
Note that similar issues arise in connection with the other cases
mentioned in Footnote 16 (function return values and union members).
The program is not strictly conforming. Since many pre-existing programs
assume that objects with the same representation are interchangeable
in these contexts, the C Standard encourages implementors to allow
such code to work, but does not require it.
Previous Defect Report
< - >
Next Defect Report