C strongly typed?

Henry Spencer henry at utzoo.uucp
Thu Mar 8 04:22:30 AEST 1990


In article <849 at enea.se> sommar at 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 at zoo.toronto.edu



More information about the Comp.lang.c mailing list