Given a function prototype, and a type definition:
int my_function(unsigned short x);
typedef unsigned short blatherskite;
Is the following situation defined by standard:
int main(int argc, char** argv) {
int result;
blatherskite b;
b=3;
result = my_function(b);
}
Do I get type coercion predictably via the function prototype?
If your question is really about whether the types of the argument and the parameter match, then the answer is yes.
typedefdoes not introduce a new type, it only creates alias for an existing one. Variablebhas typeunsigned int, just like the parameter, even thoughbis declared using typedef-nameblatherskite.Your example is not very good for demonstrating that though. All integral types are convertible to each other in C++, so (ignoring range issues) the code would have defined behavior even if
blatherskitedesignated a different type (a new type). But it doesn’t. So this is also perfectly valid