Article View: comp.std.c
Article #2911Mixing prototype and non-prototype issues
From: Tony Adams
Date: Thu, 24 Dec 1992 23:46
Date: Thu, 24 Dec 1992 23:46
42 lines
1785 bytes
1785 bytes
The following script shows an example of a function call which is not
governed by a prototype, calling a (non-visible) function defined in
prototype syntax.
Would someone please report the section numbers of the standard that
describe this programs combination of prototype and non-prototype
usage.
Thanks for any help.
Lines 1-6 show the system/compiler information
Lines 8-20 show the program example
Lines 21-25 show the compile, warnings and output
1 Script started on Thu Dec 24 18:34:23 1992
2 dspsim1% uname -a
3 SunOS dspsim1 4.1.2 1 sun4m
4 dspsim1% gcc -v
5 Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/specs
6 gcc version 2.3.1
7 dspsim1% cat c.c
8 #include <stdio.h>
9 main(int argc,char **argv)
10 {
11 float f=1.0;
12
13 func(f); /* no declaration in prototype form is visible */
14 }
15
16 /* definition of func() is not visible from main() */
17 func(float f)
18 {
19 printf("%f\n",f);
20 }
21 dspsim1% gcc -ansi c.c
22 c.c:11: warning: type mismatch with previous implicit declaration
23 c.c:6: warning: previous implicit declaration of `func'
24 dspsim1% a.out
25 1.875000
26 dspsim1% ^D
27 script done on Thu Dec 24 18:35:32 1992
Technical Details
Message-ID:
<1992Dec24.234622.29882@ll.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!gatech!udel!wupost!micro-heart-of-gold.mit.edu!xn.ll.mit.edu!ll.mit.edu!tadamsShow Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!udel!wupost!micro-heart-of-gold.mit.edu!xn.ll.mit.edu!ll.mit.edu!tadams From: tadams@ll.mit.edu ( Tony Adams) Subject: Mixing prototype and non-prototype issues Message-ID: <1992Dec24.234622.29882@ll.mit.edu> Originator: tadams@ll.mit.edu ( Tony Adams) Sender: news@ll.mit.edu Organization: MIT Lincoln Laboratory Date: Thu, 24 Dec 92 23:46:22 GMT Lines: 42