Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #11059
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Limiting function input only to __int64 but not int... |
| Date | 2011-10-24 20:58 +1300 |
| Message-ID | <9gkk4fFk5cU8@mid.individual.net> (permalink) |
| References | <j824fk$5bf$1@gregory.bnet.hr> <4ea5113f$0$6629$9b4e6d93@newsspool2.arcor-online.net> <9gkjs9Fk5cU7@mid.individual.net> |
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
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll 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