C strongly typed?

Fred Christianson flc at n.sp.cs.cmu.edu
Sat Mar 10 01:33:47 AEST 1990


In article <4401 at hydra.Helsinki.FI> grano at cs.Helsinki.FI (Kari Gran|) writes:
>a strictly (strongly? - not well defined terms anyway) typed language. 

Here's ONE POSSIBLE definition.  I'm not arguing that "strongly typed" is
well defined. I'm just giving one definition.

>From Aho, Sethi and Ullman's _Compilers,_Principles,_Techniques,_and_Tools_:

	A language is strongly typed if its compiler can guarantee that 
	the programs it accepts will execute without type errors ...

	For example if we first declare
		
		table: array[0..255] of char;
		i: integer
	
	and then compute table[i], a compiler cannot in general guarantee
	that during execution, the value of i will lie in the range 0 to 255.

The C equivalent example

	char	table[256];
	int	i;

shows that C is not "strongly typed" according to Aho, Sethi, and Ullman.

My other compiler/language books don't even use strong in their discussion
of type checking.


MY OPINION: For any reasonable definition of "strongly typed" 
	    C is not "strongly typed".

----
Fred
p.s. Let's not argue about a reasonable definition for "reasonable".



More information about the Comp.lang.c mailing list