Xref: utzoo comp.lang.c:26650 comp.lang.misc:4352 Newsgroups: comp.lang.c,comp.lang.misc Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: C strongly typed? Message-ID: <1990Mar7.182230.5517@utzoo.uucp> Organization: U of Toronto Zoology References: <259@eiffel.UUCP> <1990Mar1.172526.28683@utzoo.uucp> <849@enea.se> Date: Wed, 7 Mar 90 18:22:30 GMT In article <849@enea.se> sommar@enea.se (Erland Sommarskog) writes: >>Modern >>C is a strongly-typed language by any reasonable definition... > >C strongly typed? If I write something like... > typedef apple int; > typedef orange int; > apple a; > orange b; > ... > a = b; > >Will a "modern" compiler object? No, because the somewhat-misnamed "typedef" explicitly declares a synonym, not a new type. However, if you write something like: char *p; int a; ... a = p; any modern compiler will object. C's type system is not extensible unless you count "struct", but the language is strongly typed -- mixing random types is not allowed. -- MSDOS, abbrev: Maybe SomeDay | Henry Spencer at U of Toronto Zoology an Operating System. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu