What is type safety and what are the "type safe" alternatives?

c, c++, type-safety

Solution

Type safety means that the compiler can check whether you're using the right types. For example, if you're using `printf`, you could accidentally crash your program by writing this:

printf("The meaning of life is %s", 42);

because 42 is an integer, not a string.

Problem

Possible Duplicates: What is Type-safe? What is type-safety? I was reading about c++ vectors and it was mentioned that `memcpy` and `printf` functions from C are not type safe. Article here: http://en.wikipedia.org/wiki/Vector_(C%2B%2B). Question: In simple English, what is type safety and what are the "type safe" alternatives?

Original source

Related problems