new style declarations OK for old style definitions?
Tim McDaniel
mcdaniel at adi.com
Tue Apr 9 00:56:31 AEST 1991
The original question was about mixing an old-style, unprototyped
function definition in one file with a new-style, prototyped
declaration in another.
In article <1991Apr03.141849.26379 at convex.com> grogers at convex.com
(Geoffrey Rogers) writes:
In article <14590 at life.ai.mit.edu> tmb at ai.mit.edu writes:
> Is it sufficient to use only promoted arguments in the new-style
> declaration?
Yes. If you don't use the default promotion types you will have
problems.
Exactly.
>Is it legal for the compiler to choose
>completely incompatible calling sequences for old-style and new-style
>declarations?
Yes.
No. Section 3.5.4.3 of the Standard defines compatability of function
types. An old-style function declaration is compatable with a
new-style declaration, if the new-style uses promoted arguments and
doesn't use ellipses.
Thus, with care, you CAN mix new-style with old-style. Because of the
care required, I do not recommend such mixing.
--
"Of course he has a knife. We all have knives. It's 1183, and we're
all barbarians."
Tim McDaniel Applied Dynamics Int'l.; Ann Arbor, Michigan, USA
Internet: mcdaniel at adi.com UUCP: {uunet,sharkey}!amara!mcdaniel
More information about the Comp.lang.c
mailing list