home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!dkuug!daimi!aau!oase!morten
- From: morten@oase.kemi.aau.dk (Morten Kjeldgaard)
- Newsgroups: comp.sys.sgi
- Subject: More fun with prototyping...
- Message-ID: <morten.715425570@oase>
- Date: 2 Sep 92 09:19:30 GMT
- Sender: news@aau.dk
- Organization: Aarhus University, Denmark
- Lines: 36
- Nntp-Posting-Host: oase.kemi.aau.dk
-
- Try out this little program, compile it, and run it:
-
- main ()
- {
- float t = 1.0;
-
- printf ("t = %f ....",t);
- (void)sub(t);
- }
-
- void sub (float t) {
- printf ("%f\n",t);
- }
-
-
- On our Indigo, this program compiles perfectly, no warnings or anything. I
- get the result: t = 1.000000 ....0.000000
-
- Now try adding the prototype
-
- void sub (float);
-
- as the first line of the file. This solves the problem.
-
- This is a real burried gun, my friends. Who wants to compile with the
- -fullwarn option? You get about 15 error messages from this little test
- program. ANSI C is getting to be worse than Pascal :-{
-
-
- /Morten
-
- --
- Morten Kjeldgaard ~ morten@oase.kemi.aau.dk ~ mok@kemi.aau.dk
- Biostructural Chemistry, Department of Chemistry, Aarhus University
- Langelandsgade 140, DK-8000 Aarhus C, Denmark
- Phone: +45 86 12 46 33 ~ +45 86 20 27 11 x6518 ~ Fax: +45 86 19 61 99
-