It's my understanding that char
may have a different underlying type depending on the architecture.
During implicit casting, an unsigned char
may become and int
or an unsigned int
.
Does that mean the following code has unspecified behaviour?
#include <iostream>
void function(unsigned int){
std::cout << "unsigned\n";
}
void function(int){
std::cout << "signed\n";
}
int main() {
char c;
function(c);
}
I don't get any compiler warnings. Will it always resolve to "signed"?