Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11058

Re: Limiting function input only to __int64 but not int...

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Limiting function input only to __int64 but not int...
Date Mon, 24 Oct 2011 20:53:45 +1300
Lines 23
Message-ID <9gkjs9Fk5cU7@mid.individual.net> (permalink)
References <j824fk$5bf$1@gregory.bnet.hr> <4ea5113f$0$6629$9b4e6d93@newsspool2.arcor-online.net>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding 8bit
X-Trace individual.net rxocNvGX4J+9v3BSsfPSjwhi/oCJypPpbZhds9ULWTkY4bGdrX
Cancel-Lock sha1:jZuGIVSA3bWbKR7VwpXOPNXMFeY=
User-Agent Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4
In-Reply-To <4ea5113f$0$6629$9b4e6d93@newsspool2.arcor-online.net>
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:11058

Show key headers only | View raw


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 );

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Limiting function input only to __int64 but not int... "A" <a@a.a> - 2011-10-24 00:28 +0200
  Re: Limiting function input only to __int64 but not int... Ian Collins <ian-news@hotmail.com> - 2011-10-24 11:49 +1300
    Re: Limiting function input only to __int64 but not int... Juha Nieminen <nospam@thanks.invalid> - 2011-10-24 08:08 +0000
      Re: Limiting function input only to __int64 but not int... yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-10-24 14:24 +0000
  Re: Limiting function input only to __int64 but not int... Marc <marc.glisse@gmail.com> - 2011-10-23 22:52 +0000
    Re: Limiting function input only to __int64 but not int... "A" <a@a.a> - 2011-10-24 01:32 +0200
  Re: Limiting function input only to __int64 but not int... Goran <goran.pusic@gmail.com> - 2011-10-23 23:29 -0700
    Re: Limiting function input only to __int64 but not int... "A" <a@a.a> - 2011-10-24 17:11 +0200
      Re: Limiting function input only to __int64 but not int... Robert Wessel <robertwessel2@yahoo.com> - 2011-10-24 12:17 -0500
        Re: Limiting function input only to __int64 but not int... Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-24 13:49 -0400
        Re: Limiting function input only to __int64 but not int... "A" <a@a.a> - 2011-10-25 00:12 +0200
          Re: Limiting function input only to __int64 but not int... Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-24 20:20 -0400
          Re: Limiting function input only to __int64 but not int... Christian Gollwitzer <auriocus@gmx.de> - 2011-10-25 07:27 +0200
            Re: Limiting function input only to __int64 but not int... Arne Mertz <arnemertz@googlemail.com> - 2011-10-26 01:02 -0700
  Re: Limiting function input only to __int64 but not int... Marcel Müller <news.5.maazl@spamgourmet.com> - 2011-10-24 09:18 +0200
    Re: Limiting function input only to __int64 but not int... Ian Collins <ian-news@hotmail.com> - 2011-10-24 20:53 +1300
      Re: Limiting function input only to __int64 but not int... Ian Collins <ian-news@hotmail.com> - 2011-10-24 20:58 +1300

csiph-web