C strongly typed?

Jim Giles jlg at lambda.UUCP
Thu Mar 8 08:19:20 AEST 1990


>From article <849 at enea.se>, by sommar at enea.se (Erland Sommarskog):
> [...]
> 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;

Yes C is strongly typed - by the definition of 'strong typing'.  The
phrase 'strong typing' means that the type of any object in an scope
can be determined at compile time.  So, in the example you gave, it is
quite trivial to determine the data types of all the objects given just
by examining the text.  C is not only strongly typed, but it requires
explicit declarations of everything.

You are confusing 'strong typing' with 'strict type checking'.  The
later term refers to languages which discourage (or even disallow)
any mixed-mode operations without _explicit_ type coersions.  To be
sure, strict typing is easier to do if the language is also strongly
typed - this is probably how this confusion of terms (which is common)
originally arose.  But a strict language isn't necessarily strongly
typed.  Any language which allows late binding is (again by definition)
_not_ stongly typed - but such a language may still restrict mixed-mode
operations; it would just have to do all the checking at run-time.

J. Giles



More information about the Comp.lang.c mailing list