Defect Report #070

Submission Date: 03 Dec 93
Submittor: WG14
Source: Clive Feather
Item 7 - interchangeability of function arguments
Consider the following program:
#include <stdio.h>

void output (c)
int c;
printf("C == %d\n", c);
int main (void)
return 0;

The constant 6 has type int, and 6U has type unsigned int (subclause, and they have the same representation (subclause 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 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