C strongly typed?
Erland Sommarskog
sommar at enea.se
Sat Mar 10 10:06:59 AEST 1990
Henry Spencer (henry at utzoo.uucp) writes:
)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.
Well, apparently I am allowed to mix apples and oranges. If I have
two types of data that both happens to be represented by integers,
but have no logical connection what so ever I cannot apparently
express that in C. And consequently I cannot take help from the
compiler to catch inadvertent mixups in for instance procedure calls.
--
Erland Sommarskog - ENEA Data, Stockholm - sommar at enea.se
More information about the Comp.lang.c
mailing list