ip%sun.central-services.umist.ac.uk@NSS.CS.UCL.AC.UK (Ian Pallfreeman) (10/11/88)
Hi,
First bug report from me; hope I have the procedure right (not to mention
the address :-))
We're running GCC 1.28 on a Sun 3/280; I'm trying to port an application
which compiles and runs successfully with Zortech C and having problems
with a very simple piece of code:
void somefunc(char);
void somefunc(c)
char c;
{
}
which gives me:
In function somefunc:
test.c:6: argument `c' doesn't match function prototype
Alter the definition to:
void somefunc(char c)
{
}
and it compiles OK.
Obviously I can live with something that minor, but you aught to know,
I guess.
Cheers,
Ian
{Systems/Net Support & General Dogsbody}
|===================================================================|
| janet: ian@uk.ac.umist | Science and Engineering Research Council |
| inet: ian@umist.ac.uk | Engineering Computing Facility |
| uucp: ?!ukc!umist!ian | University of Manchester |
| tel: +44-61-228-2397 | Institute of Science and Technology |
|===================================================================|drh@notecnirp.Princeton.EDU (Dave Hanson) (10/13/88)
In article <25747.8810111420@sun> ip%sun.central-services.umist.ac.uk@NSS.CS.UCL.AC.UK (Ian Pallfreeman) writes:
having problems with a very simple piece of code:
void somefunc(char);
void somefunc(c) char c; { }
which gives me:
In function somefunc:
test.c:6: argument `c' doesn't match function prototype
Alter the definition to:
void somefunc(char c) { }
and it compiles OK.
this isn't a bug; it's correct. the problem is that the
1st *definition* of somefunc() above is given in
`old-style'. hence, default argument promotions apply,
which cause actual argument to be promoted to int. thus,
the `inferred prototype' given by the definition is
`void somefunc(int)', which conflicts with the prototype given
explicitly, which is retained.