🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1788

Re: GCC 1.28 prototyping bug

#1788
From: Dave Hanson
Date: Thu, 13 Oct 1988 01:13
25 lines
1262 bytes
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.
Technical Details
Message-ID: <12571@princeton.Princeton.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!njin!princeton!notecnirp!drh
References: <25747.8810111420@sun>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!njin!princeton!notecnirp!drh
From: drh@notecnirp.Princeton.EDU (Dave Hanson)
Newsgroups: gnu.gcc.bug
Subject: Re: GCC 1.28 prototyping bug
Message-ID: <12571@princeton.Princeton.EDU>
Date: 13 Oct 88 01:13:45 GMT
References: <25747.8810111420@sun>
Sender: news@princeton.Princeton.EDU
Reply-To: drh@notecnirp.UUCP (Dave Hanson)
Distribution: gnu
Organization: Dept. of Computer Science, Princeton University
Lines: 25