TITLE: Argument matching is implementation-dependent


[ Adapted from "C++ Gotchas", tutorial notes by Tom Cargill,
  p. 35 ]


#include <streams.h>

class C {
  public:
    void f (int)      { cout << "C::f(int)" << endl; }
    void f (unsigned) { cout << "C::f(unsigned)" << endl; }
};

int main ()
{
    unsigned short us = 0;
    C x;

    cout << "sizeof(short)=" << sizeof(short) << endl;
    cout << "sizeof(int)=" << sizeof(int) << endl;

    x.f (us);  // which f?
    return 0;
}


This program outputs the following on one machine:

	sizeof(short)=2 sizeof(int)=4
 	C::f(int)

and on another machine, the output is

	sizeof(short)=2 sizeof(int)=2
 	C::f(unsigned)

For more information, see discussion in the ARM, p. 322
