Optional vs. required diagnostics

Karl Heuer karl at haddock.ima.isc.com
Wed Jul 25 09:56:04 AEST 1990


Must the following code fragments generate a diagnostic?
	/* [0] */ double *p;   int x;   p = &x;
	/* [1] */ void f(double *p);   int x;   f(&x);

[0] is illegal because of 3.3.4 ("Conversions that involve pointers (other
than ...) shall be specified by means of an explicit cast"), but since it
appears under Semantics rather than Constraints, it seems to be merely a
case of undefined behavior, and hence the compiler may choose to be silent.

[1] is similar, but the place where 3.3.2.2 requires assignment-compatibility
for prototype arguments *is* under the Constraints section.  Does this cause
the implicit reference to 3.3.4 to be covered by the 3.3.2.2 Constraints
for this particular case, and hence require a diagnostic?  Or can an
implementation choose to accept [0] as a Conforming Extension and then claim
that [1] does not violate 3.3.2.2, since, *in this implementation*, the
actual and formal parameters *are* assignment-compatible?

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.std.c mailing list