typedef laxity

Greg Pasquariello X1190 gp at picuxa.UUCP
Sat Apr 9 00:00:48 AEST 1988


In article <1070 at maynard.BSW.COM> campbell at maynard.BSW.COM (Larry Campbell) writes:
>It seems to me someone should complain about this code:
>
>	typedef int TEMPERATURE;
>	typedef int PRESSURE;
>
>	TEMPERATURE tx, ty;
>	PRESSURE px, py;
>
>	ty = py;		/* type clash */
>
>But none of the compilers I've tested (pcc, VAX-11 C, Wang VS C, Turbo C)
>complain about it, and, even worse, _lint_ doesn't complain!


The compiler does not complain about this, because it is not really a type
clash.  Typedef simply creates synonyms for a type.  The compiler treats both
"new types" the same as int.

>Larry Campbell                                The Boston Software Works, Inc.

Greg Pasquariello
ihnp4!picuxa!gp
                                                                      
                                                               
                                                            
                                                                
                                                
                                                     
                                  



More information about the Comp.lang.c mailing list