Xref: utzoo comp.lang.c:26672 comp.lang.misc:4363 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!uokmax!munnari.oz.au!goanna!ok From: ok@goanna.oz.au (Richard O'keefe) Newsgroups: comp.lang.c,comp.lang.misc Subject: Re: C strongly typed? Message-ID: <2963@goanna.oz.au> Date: 8 Mar 90 00:11:17 GMT References: <259@eiffel.UUCP> <1990Mar1.172526.28683@utzoo.uucp> <849@enea.se> Followup-To: comp.lang.c Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 37 In article <849@enea.se>, sommar@enea.se (Erland Sommarskog) writes: > C strongly typed? If I write something like: (I don't speak C > so the syntax is probably bogus.) > typedef apple int; > typedef orange int; > apple a; > orange b; > ... > a = b; > Will a "modern" compiler object? No, of course not. Try it in Pascal: program main; type apple = integer; orange = integer; var a: apple; o: orange; begin a := o; end. A Pascal compiler may complain that "o" is uninitialised, but it *must* accept the assignment as well-typed. (I tried it.) Try it in Ada (not checked, as I haven't access to an Ada compiler): declare subtype apple is integer; subtype orange is integer; a: apple; o: orange := 1; begin a := o; end Again, the assignment is well-typed. Why should C be different?