Type checking: shouldn't lint/cc complain?

Henry Spencer henry at utzoo.UUCP
Sun Oct 14 09:33:19 AEST 1984


> typedef int FOO ;
> typedef int BAR ;
> 
> #define XXX (FOO) 1
> 
> ...
> 
> 	BAR fff ;
> 
> 	fff = XXX ;
> 
> When I run lint or cc on this program (on 4.1BSD or 4.2BSD), I
> get no complaints about the fact that fff is a variable of type
> BAR and it is being assigned a value of type FOO. ...

If you look at the specs of typedef, it's explicitly defined to be
purely an abbreviation mechanism, with no effect on type matching.
So this is legal C.  It *would* be nice if lint would complain...
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list