On 10/24/11 08:53 PM, Ian Collins wrote:
> On 10/24/11 08:18 PM, Marcel Müller wrote:
>> On 24.10.2011 00:28, A wrote:
>>> Is there a way (except overloading) to limit function input to accept
>>> __int64 but to get a compiler (preferable) or runtime (less preferable)
>>> error if it is called with int?
>>
>>> for example:
>>>
>>> void myfunction(__int64 param) // Accepts only __int64 as input and no
>>> smaller
>> void myfunction(const __int64& param);
>
> Won't the normal promotion rules still apply?
>
> myfunction( 2 );
>
> Compiles happily as does
>
> int n = 0;
> myfunction( n );
Hit send too soon, I was going to add that
void myfunction( int64_t& param );
was probably what you intended to type.
--
Ian Collins
|