home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / sgi / 13185 < prev    next >
Encoding:
Internet Message Format  |  1992-09-01  |  1.2 KB

  1. Path: sparky!uunet!mcsun!sunic!dkuug!daimi!aau!oase!morten
  2. From: morten@oase.kemi.aau.dk (Morten Kjeldgaard)
  3. Newsgroups: comp.sys.sgi
  4. Subject: More fun with prototyping...
  5. Message-ID: <morten.715425570@oase>
  6. Date: 2 Sep 92 09:19:30 GMT
  7. Sender: news@aau.dk
  8. Organization: Aarhus University, Denmark
  9. Lines: 36
  10. Nntp-Posting-Host: oase.kemi.aau.dk
  11.  
  12. Try out this little program, compile it, and run it:
  13.  
  14. main ()
  15. {
  16.   float t = 1.0;
  17.  
  18.   printf ("t = %f ....",t);
  19.   (void)sub(t);
  20. }
  21.  
  22. void sub (float t) {
  23.   printf ("%f\n",t);
  24. }
  25.  
  26.  
  27. On our Indigo, this program compiles perfectly, no warnings or anything. I
  28. get the result: t = 1.000000 ....0.000000
  29.  
  30. Now try adding the prototype
  31.  
  32. void sub (float);
  33.  
  34. as the first line of the file. This solves the problem.
  35.  
  36. This is a real burried gun, my friends. Who wants to compile with the
  37. -fullwarn option? You get about 15 error messages from this little test
  38. program. ANSI C is getting to be worse than Pascal :-{
  39.  
  40.  
  41. /Morten
  42.  
  43. --
  44. Morten Kjeldgaard  ~ morten@oase.kemi.aau.dk ~ mok@kemi.aau.dk
  45. Biostructural Chemistry, Department of Chemistry, Aarhus University
  46. Langelandsgade 140, DK-8000 Aarhus C, Denmark
  47. Phone: +45 86 12 46 33 ~ +45 86 20 27 11 x6518 ~ Fax: +45 86 19 61 99
  48.