Curious about function prototypes...

Doug Gwyn gwyn at brl-smoke.ARPA
Sat Jun 18 11:33:44 AEST 1988


In article <5808 at bloom-beacon.MIT.EDU> scs at adam.pika.mit.edu (Steve Summit) writes:
>How much, and why, are old-style declarations disparaged in new-style code?

Mixing of old- and new-style declarations/definitions should work okay
so long as the functions take a fixed number of arguments, each of which
has a type that is not changed by the old-style argument widening rules.

The main reason that the interface is allowed to differ between old- and
new-style functions is to permit implementations to avoid widening, for
example of float to double or of char to int.  It also makes for stricter
type checking.

>Is it wrong for a compiler to construct some kind of Miranda prototype, when
>an old-style function definition is seen, which could be used for lint-style
>argument mismatch warnings (*not* ANSI-style implicit argument coercions)?

The compiler can issue any warnings it wishes, but to be Standard conforming
it must follow the rules (i.e. produce valid code from a valid program).



More information about the Comp.lang.c mailing list