typedef laxity

William E. Davidsen Jr davidsen at steinmetz.ge.com
Fri Apr 8 03:50:53 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 */

  The Xenix compiler will complain if you set the warning level higher
than the default. I ran your code with -W3 and got a "strong type
mismatch." I also use the -Zg option to produce my function prototypes
for a "proto.h" file. Output follows (I *like* compilers which can give
you a listing!).



                                                                       PAGE   1
                                                                       04-07-88
                                                                       12:48:07

  Line#  Source Line                   Xenix 8086/80286 C Compiler Release 2.00

      1  typedef int TEMP;
      2  typedef int PRES;
      3  
      4  TEMP tx, ty;
      5  PRES px, py;
      6  
      7  main() {
      8    ty = py;
***** x.c(8) : warning 50: strong type mis-match
      9    px = py;
     10    ty = (TEMP)py;
     11  }
***** x.c(11) : warning 35: no return value



Global Symbols

Name                            Type             Size    Class    Offset

main. . . . . . . . . . . . . . near function     ***    global     0000
px. . . . . . . . . . . . . . . int                 2    common      ***
py. . . . . . . . . . . . . . . int                 2    common      ***
tx. . . . . . . . . . . . . . . int                 2    common      ***
ty. . . . . . . . . . . . . . . int                 2    common      ***

Code size = 0023 (35)
Data size = 0000 (0)
Bss size  = 0000 (0)

No errors detected

-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list