C strongly typed?

Kari Gran| grano at cs.Helsinki.FI
Fri Mar 9 10:30:18 AEST 1990


In article <2963 at goanna.oz.au> ok at goanna.oz.au (Richard O'keefe) writes:
!Try it in Ada (not checked, as I haven't access to an Ada compiler):
!	declare
!	    subtype apple  is integer;
!	    subtype orange is integer;
!	    a: apple;
!	    o: orange := 1;
!	begin
!	    a := o;
!	end
!Again, the assignment is well-typed.  Why should C be different?

	But you're using Ada's _subtypes_, which hide the fact that Ada is
a strictly (strongly? - not well defined terms anyway) typed language. If
you try

	declare
		type apple is integer;
		type orange is integer;
		a : apple;
		o : orange;
	begin a:= o; end;

then the types aren't any longer compatible and the assignment is thus
illegal.

Kari.
--
Kari Grano	grano at cs.helsinki.fi	Hey, my opinions are just mine..
	"I've got a thousand telephones that don't ring" - R.Z.



More information about the Comp.lang.c mailing list