I have one file in which I use "int16_t x", when I declared it in other file, by mistake I have declared "extern int8_t x". i.e int8_t is used instead of int16_t.
But compiler do not generate warning for this. Why. Is there any method for it or it has to be taken care by the programmer only.
There was a reason why C++ added type-safe linking by using name mangling, where the symbol names of external symbols are mangled with extra character data representing the data type of the symbol.
So an int8_t variable and an int16_t variable using the same name in the source code would have different names in the object files resulting in a linking failure.
But as noted earlier - the code should be written so the compiler sees both declaration and definition and can spot any important difference. So all files making use of a variable should include the header file where the variable was mentioned.