Anyone on ANSI standard C - (nf)

dan at haddock.UUCP dan at haddock.UUCP
Thu Feb 9 14:38:31 AEST 1984


#R:rlgvax:-167200:haddock:12400003:000:853
haddock!dan    Feb  8 17:03:00 1984

I have a question about the effects of specifying parameter types in
the ANSI C standard.  What will the exact effect be when the type of an
actual parameter differs from the type given in the declaration?  Seems to
me that while silently casting is usually the right thing, in some cases
the compiler should issue warnings because the odds are good the
user is making a mistake.  I think the compiler should cast silently
if the declared and actual types are both arithmetic, regardless of
length or signed/unsigned distinctions (leave warnings about lost
accuracy to lint), or if the declared type is a pointer of any type and the
actual parameter is the constant 0, but warn the user about everything
else (e.g., using an int or char* where a FILE* was expected).  In this
way one avoids the absurd implicit problems of PL/I.  Is this how it's done?



More information about the Comp.lang.c mailing list