🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9298

Re: enum function bug?

#9298
From: Guy Harris
Date: Fri, 12 Sep 1986 09:33
23 lines
1483 bytes
> I want to pass a
> 	pointer to function returning "bool"
> to a function, but lint says I'm not doing it right.  I think I am,
> aren't I? ... Is this a bug?


Yes, and yes.  PCC converts "enum"s into "char"s, "short"s, or "int"s at a
fairly early stage in its processing.  Unfortunately, this means "lint" does
also.  As such, "pointer to function returning enum" gets converted to
"pointer to function returning char/short/int", which collides with the
formal argument of "f".  In this particular case, I tried it and it gave the
errors listed; I changed the function pointer declarations to "int (*xx)()"
and it passed.

The fix is not to convert "enum"s in that fashion in "lint", and fix pass 2
to check that enum formal arguments match the actual arguments used.

You can tell the parts of the language that were added later; the front end
of PCC doesn't really handle them right.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)
Technical Details
Message-ID: <7198@sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!pyramid!decwrl!sun!guy
References: <299@sdchema.sdchem.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!pyramid!decwrl!sun!guy
From: guy@sun.uucp (Guy Harris)
Newsgroups: net.lang.c
Subject: Re: enum function bug?
Message-ID: <7198@sun.uucp>
Date: Fri, 12-Sep-86 05:33:32 EDT
Article-I.D.: sun.7198
Posted: Fri Sep 12 05:33:32 1986
Date-Received: Fri, 12-Sep-86 22:22:18 EDT
References: <299@sdchema.sdchem.UUCP>
Distribution: na
Organization: Sun Microsystems, Inc.
Lines: 23