enum function bug?

Stuart D. Gathman stuart at BMS-AT.UUCP
Sat Oct 4 14:36:23 AEST 1986


In article <3635 at umcp-cs.UUCP>, chris at 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>



More information about the Comp.lang.c mailing list