🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9493

Re: enum function bug?

#9493
From: Stuart D. Gathman
Date: Sat, 04 Oct 1986 04:36
28 lines
1583 bytes
In article <3635@umcp-cs.UUCP>, chris@umcp-cs.UUCP (Chris Torek) writes:

> 	x.c
> 	::::::::::::::
> 	struct s { int i; };
> 	proc(p) struct s *p; { p->i = 1; }
> 	struct s func() { struct s temp; temp.i = 0; return (temp); }

> 	y.c
> 	::::::::::::::
> 	struct s { int i; };
> 	struct s func();
> 	main() { struct s temp; temp = func(); proc(&temp); }

> 	% lint -h x.c y.c
> 	x.c:
> 	y.c:

Hmmmmm.... On trying this I see that only one of our two versions of lint
uses the algorithm I described (the version with CTIX for the 68010).  
I still think that this example should
generate an error.  It is dangerous to have things defined in more than
one place.  The algorithm I described is safe.  You can't define structures
with the same name twice (in the same scope).  Lint doesn't need to look
at the actual structure definition, and can still flag code that should
be flagged (like the above example).
-- 
Stuart D. Gathman	<..!seismo!{vrdxhq|dgis}!BMS-AT!stuart>
Technical Details
Message-ID: <236@BMS-AT.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!vrdxhq!BMS-AT!stuart
References: <299@sdchema.sdchem.UUCP> <86900054@haddock> <572@opus.nbires.UUCP> <3635@umcp-cs.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!vrdxhq!BMS-AT!stuart
From: stuart@BMS-AT.UUCP (Stuart D. Gathman)
Newsgroups: net.lang.c
Subject: Re: enum function bug?
Message-ID: <236@BMS-AT.UUCP>
Date: Sat, 4-Oct-86 00:36:23 EDT
Article-I.D.: BMS-AT.236
Posted: Sat Oct  4 00:36:23 1986
Date-Received: Tue, 7-Oct-86 20:04:00 EDT
References: <299@sdchema.sdchem.UUCP> <86900054@haddock> <572@opus.nbires.UUCP> <3635@umcp-cs.UUCP>
Organization: Business Management Systems, Inc., Fairfax, VA
Lines: 28
Summary: structure mapping in lint