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