Xref: utzoo comp.lang.c:26875 comp.lang.misc:4437 Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!dkuug!iesd!iesd.auc.dk!fischer From: fischer@iesd.auc.dk (Lars P. Fischer) Newsgroups: comp.lang.c,comp.lang.misc Subject: Re: C strongly typed? Message-ID: Date: 13 Mar 90 21:26:05 GMT References: <259@eiffel.UUCP) <1990Mar1.172526.28683@utzoo.uucp) <849@enea.se) <1990Mar7.182230.5517@utzoo.uucp) <862@enea.se> Sender: news@iesd.auc.dk (UseNet News) Organization: Mathematics and Computer Science, University of Aalborg Lines: 39 In-reply-to: sommar@enea.se's message of 10 Mar 90 00:06:59 GMT In article <862@enea.se> sommar@enea.se (Erland Sommarskog) writes: >Well, apparently I am allowed to mix apples and oranges. If I have >two types of data that both happens to be represented by integers, >but have no logical connection what so ever I cannot apparently >express that in C. True. C has type synonyms, but you cannot introduce new types. It a pain at times, but you learn to live with it. Note that this does *not* mean that C is not strongly typed (it is). It means that there are some type constructions mechanisms that are not available in C. >And consequently I cannot take help from the >compiler to catch inadvertent mixups in for instance procedure calls. However: banach> cat te.c typedef enum { o1, o2 } orange ; typedef enum { a1, a2 } apple ; orange o; apple a; void main () { o = o1; a = o; } banach> lint te.c te.c(10): warning: enumeration type clash, operator = banach> Use lint, not Ada. /Lars -- Lars Fischer, fischer@iesd.auc.dk | Q: How does a project get to be one CS Dept., Univ. of Aalborg, DENMARK. | year late? A: One day at a time.