I have the following code:
#include <iostream>
#include <string>
typedef unsigned char type1;
typedef unsigned long type2;
type1 f(type1 value)
{
return value * 2;
}
int main()
{
type1 value1 = 1;
type2 value2 = 2000;
int int1 = f(value1);
int int2 = f(value2); // here I would expect that the compiler warns me that I mix type1 and type2
std::cout << int1 << std::endl;
std::cout << int2 << std::endl;
}
Is there a way that the compiler warns me if I mix the two types type1 (unsigned char) and type2 (unsigned long)?
Thanks Teddy