Maybe it supports #pragma error?
Then you can write
#pragma error is not very portable, e.g. MSVC does not
sopport it, instead, it issues a warning about the
unsupported pragma and happily continues compiling,
i.e. f(int) may be called.
overloading f(int) and f(__int64) imo is not a good idea,
because once you port the whole thing to a 64 bit machine
int and __int64 become the same and you get either a
redefinition error (if you actually defined f(int)), or
the whole "error detection via link error or ambiguity"
magically dissapears if you only declared f(int), as it
is just another declaration of f(__int64).
In your case the latter behavior may be ok, if the
problem is only about disambiguating 32 bit int and __in64
in 32 bit systems. But maybe StrToInt outputs __int32
even on 64 bit systems or something similar happens so you
want to keep up the 32 bit integer detection even on 64 bit
systems.
To make things short(er), I would use overloading, but not
with any specific integer type but with a template:
given f(__int64) as the function to be called only for
64bit types, you have several variants
Variant a)
template <typename T>
void f(T) = delete; //overload resolution calls this for
any T that is not the same as __int64
Variant b), C++0x without deleted functions
template <typename T>
void f(T)
{ static_assert(false, "call f only with __int64!"); }
Variant c), C++0x, less restrictive
#include <type_traits>
template <typename T>
f(T t) -> decltype(f(__int64))
{
// assert T is "sufficiently close to" __int64
static_assert(std::is_integral<T>::value
&& std::is_convertible<T, __int64>::value
&& sizeof(T) >= sizeof(__int64));
return f(__int64(t));
}
If your compiler lacks support for static_assert, you
could use either std::enable_if or the STATIC_ASSERT
macro from the loki library. If your standard library
has no <type_traits>, boost provides similar utilities.
HTH Arne