home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11609 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  1.7 KB

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!agate!dog.ee.lbl.gov!horse.ee.lbl.gov!torek
  2. From: torek@horse.ee.lbl.gov (Chris Torek)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Error in MS C 6.0 ?
  5. Date: 26 Jul 1992 01:23:25 GMT
  6. Organization: Lawrence Berkeley Laboratory, Berkeley
  7. Lines: 29
  8. Message-ID: <24899@dog.ee.lbl.gov>
  9. References: <1992Jul21.175215.13891@vax5.cit.cornell.edu> <1992Jul22.204254.4707@dg-rtp.dg.com>
  10. Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
  11. NNTP-Posting-Host: 128.3.112.15
  12.  
  13. >Distribution: comp
  14. (comp is not a distribution.  Please check your news software.)
  15.  
  16. >In article <1992Jul21.175215.13891@vax5.cit.cornell.edu>
  17. >rdw@vax5.cit.cornell.edu writes:
  18. >>When passing single-precision float arguments to a function, I get
  19. >>compilation errors when I try to use the following together:   
  20. >>prototyping in the function allusion but 'old-style' argument
  21. >>declarations when defining the function.
  22.  
  23. If `allusion' means `declaration', this is entirely correct (see my
  24. previous article on prototypes).
  25.  
  26. [the example:]
  27. >>int func(int a, float x, int b);            /* DECLARATION */
  28. >>int func(a, x, b) int a; float x; int b; { ... }    /* DEFINITION */
  29.  
  30. In article <1992Jul22.204254.4707@dg-rtp.dg.com> welshm@snail.rtp.dg.com
  31. (Matt Welsh) writes:
  32. >Of course. If you use a prototype, MSC will expect new-style function def's.
  33. >You get a Parameter 2 mismatch because MSC thinks that "x" is an integer.
  34.  
  35. No: in fact, the definition claims that `x' is a `double'.  The
  36. declaration claims, contrarily, that `x' is a `float'.  The two are not
  37. compatible.  You can either use prototype syntax for the definition (as
  38. Matt Welsh suggests) or declare x `double' in the prototype.
  39. -- 
  40. In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
  41. Berkeley, CA        Domain:    torek@ee.lbl.gov
  42.