C strongly typed?

William Thomas Wolfe, 2847 billwolf%hazel.cs.clemson.edu at hubcap.clemson.edu
Mon Mar 12 14:52:24 AEST 1990


>From article <0500 at sheol.UUCP>, by throopw at sheol.UUCP (Wayne Throop):
%> From: flc at n.sp.cs.cmu.edu (Fred Christianson)
%> 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.
> 
> By this definition, are there ANY stronly typed languages in the
> algol family?  I can't think of any strongly typed languages by this
> definition that are in what I'd call practial use.  Can anybody else?
> Certainly Ada, ModulaII, and Pascal all fail this test, do they not?

   No compiler could make such a guarantee.  However, two points:

      1) i should have been declared "integer range table'range;",
           which would have enabled the compiler to enforce the constraint...

      2) even without the constraint, Ada's exception handling facility will
           handle the error by raising the predefined exception Numeric_Error.


   Bill Wolfe, wtwolfe at hubcap.clemson.edu



More information about the Comp.lang.c mailing list