Re: Invoking a function through function pointer
- From: Andrey Tarasevich <andreytarasevich@xxxxxxxxxxx>
- Date: Wed, 27 Apr 2005 12:03:15 -0700
Peter Nilsson wrote:
> ...
> It's a little known quirk that both C and C++ accept...
>
> #include <stdio.h>
>
> int main(void)
> {
> (***** /*...*/ *****puts)("Hello World!");
> return 0;
> }
>
> Indirection on an expression with function type just produces the
> same function designator.
> ...
.... although the term "function designator" is C-specific. In C++ the
situation is a bit different and, for example, as a consequence of that,
the extra parentheses (with or without '*' inside) will disable
argument-dependent name lookup
namespace test {
struct s {};
void foo(s);
}
int main() {
test::s s;
foo(s); // OK
(foo)(s); // ERROR
(*foo)(s); // ERROR
}
--
Best regards,
Andrey Tarasevich
.
- References:
- Invoking a function through function pointer
- From: Ravi kumar.N
- Re: Invoking a function through function pointer
- From: Chris Dollin
- Re: Invoking a function through function pointer
- From: Angad
- Re: Invoking a function through function pointer
- From: Chris Dollin
- Re: Invoking a function through function pointer
- From: Peter Nilsson
- Invoking a function through function pointer
- Prev by Date: Re: Newbie howto question.
- Next by Date: Re: programming job market in bay area in US
- Previous by thread: Re: Invoking a function through function pointer
- Next by thread: Re: Invoking a function through function pointer
- Index(es):
Relevant Pages
|