digitalmars.D - function overloading of address
- sdvcn (11/11) Dec 02 2014 void ac(int aa)
- bearophile (12/23) Dec 02 2014 This code:
- H. S. Teoh via Digitalmars-d (14/46) Dec 02 2014 [...]
- sdvcn (3/41) Dec 02 2014 how take (void foo(int)) address?
- ketmar via Digitalmars-d (6/42) Dec 02 2014 ote:
- sdvcn (3/46) Dec 02 2014 Thank you.
- H. S. Teoh via Digitalmars-d (6/12) Dec 02 2014 Ah, of course. I'm getting too used to type inference. :-P
- ketmar via Digitalmars-d (3/14) Dec 02 2014 me too. the first thing i tried was `&foo(0)` to hint the type.
void ac(int aa) { } void ac(void *a2) { } int main(string[] argv) { auto v = ∾ //<--- who address } who get "void ac(int aa)" address ?
Dec 02 2014
sdvcn:void ac(int aa) { } void ac(void *a2) { } int main(string[] argv) { auto v = ∾ //<--- who address } who get "void ac(int aa)" address ?This code: void foo(int) {} void foo(void*) {} void main() { auto pfoo = &foo; } Gives: test.d(5,17): Error: cannot infer type from overloaded function symbol & foo Bye, bearophile
Dec 02 2014
On Wed, Dec 03, 2014 at 02:11:54AM +0000, bearophile via Digitalmars-d wrote:sdvcn:[...] How do you take the address of specific overload, though? T -- Arise, you prisoners of Windows Arise, you slaves of Redmond, Wash, The day and hour soon are coming When all the IT folks say "Gosh!" It isn't from a clever lawsuit That Windowsland will finally fall, But thousands writing open source code Like mice who nibble through a wall. -- The Linux-nationale by Greg Bakervoid ac(int aa) { } void ac(void *a2) { } int main(string[] argv) { auto v = ∾ //<--- who address } who get "void ac(int aa)" address ?This code: void foo(int) {} void foo(void*) {} void main() { auto pfoo = &foo; } Gives: test.d(5,17): Error: cannot infer type from overloaded function symbol & foo
Dec 02 2014
On Wednesday, 3 December 2014 at 02:20:32 UTC, H. S. Teoh via Digitalmars-d wrote:On Wed, Dec 03, 2014 at 02:11:54AM +0000, bearophile via Digitalmars-d wrote:how take (void foo(int)) address?sdvcn:[...] How do you take the address of specific overload, though? Tvoid ac(int aa) { } void ac(void *a2) { } int main(string[] argv) { auto v = ∾ //<--- who address } who get "void ac(int aa)" address ?This code: void foo(int) {} void foo(void*) {} void main() { auto pfoo = &foo; } Gives: test.d(5,17): Error: cannot infer type from overloaded function symbol & foo
Dec 02 2014
On Tue, 2 Dec 2014 18:18:26 -0800 "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> wrote:On Wed, Dec 03, 2014 at 02:11:54AM +0000, bearophile via Digitalmars-d wr=ote:& foosdvcn: =20void ac(int aa) { } void ac(void *a2) { } int main(string[] argv) { auto v =3D ∾ //<--- who address } who get "void ac(int aa)" address ?=20 This code: =20 =20 void foo(int) {} void foo(void*) {} =20 void main() { auto pfoo =3D &foo; } =20 =20 Gives: =20 test.d(5,17): Error: cannot infer type from overloaded function symbol =[...] =20 How do you take the address of specific overload, though?declare the necessary function type instead of auto: void function (int) pfoo =3D &foo;
Dec 02 2014
On Wednesday, 3 December 2014 at 02:31:20 UTC, ketmar via Digitalmars-d wrote:On Tue, 2 Dec 2014 18:18:26 -0800 "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> wrote:Thank you.On Wed, Dec 03, 2014 at 02:11:54AM +0000, bearophile via Digitalmars-d wrote:declare the necessary function type instead of auto: void function (int) pfoo = &foo;sdvcn:[...] How do you take the address of specific overload, though?void ac(int aa) { } void ac(void *a2) { } int main(string[] argv) { auto v = ∾ //<--- who address } who get "void ac(int aa)" address ?This code: void foo(int) {} void foo(void*) {} void main() { auto pfoo = &foo; } Gives: test.d(5,17): Error: cannot infer type from overloaded function symbol & foo
Dec 02 2014
On Wed, Dec 03, 2014 at 04:31:11AM +0200, ketmar via Digitalmars-d wrote:On Tue, 2 Dec 2014 18:18:26 -0800 "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> wrote:[...]Ah, of course. I'm getting too used to type inference. :-P T -- If you look at a thing nine hundred and ninety-nine times, you are perfectly safe; if you look at it the thousandth time, you are in frightful danger of seeing it for the first time. -- G. K. ChestertonHow do you take the address of specific overload, though?declare the necessary function type instead of auto: void function (int) pfoo = &foo;
Dec 02 2014
On Tue, 2 Dec 2014 18:40:45 -0800 "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> wrote:On Wed, Dec 03, 2014 at 04:31:11AM +0200, ketmar via Digitalmars-d wrote:me too. the first thing i tried was `&foo(0)` to hint the type.On Tue, 2 Dec 2014 18:18:26 -0800 "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> wrote:[...]=20 Ah, of course. I'm getting too used to type inference. :-PHow do you take the address of specific overload, though?declare the necessary function type instead of auto: =20 void function (int) pfoo =3D &foo;
Dec 02 2014