lint, pointers, 0 (what else?)

Guy Harris guy at rlgvax.UUCP
Sun Feb 10 04:23:46 AEST 1985


> 	Does the standard require compilers to generate warnings  when
> they have to generate a cast of function arguments? The potential  for
> truly sloppy coding seems enormous with this change.

No, it doesn't have any such requirement; arguably, it's the same as

	double d;
	int i;

	d = i;

which also requires a coercion.  I see your point that, unlike this case,
where both variables are in the same module and it is assumed that the
program knows what they're doing, programmer A may simply not realize
that the program wants a "double", or may get the number or order of the
arguments wrong, when calling the procedure written by programmer B.

If the coercion "doesn't make sense" (e.g., the routine expects a "struct
frobozz *" and is being passed a "struct death *"), PCC, at least, will
complain (as it currently does with similar assignments).  If the coercion
isn't doable (e.g., the routine expects a "struct frobozz" and is being passed
an "int"), a reasonable compiler will complain and won't generate code.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.lang.c mailing list