Why can `(*)` be omitted from a function pointer inside a function parameter list?

 Clash Royale CLAN TAG#URR8PPP
Clash Royale CLAN TAG#URR8PPP
up vote
8
down vote
favorite
Compiling with gcc8:
#include <stdio.h>
void some_func(void f1(void), void (*f2)(void))
 printf("%dn", f1);
 printf("%dn", f2);
Gives (only) the following warnings:
<source>:11:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
 printf("%dn", f1);
<source>:12:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
 printf("%dn", f2);
Why is the type of f1 the same as f2? Only f2 is declared as a function pointer. I would expect f1 not to compile at all, as it names a function type, not a function pointer. What is the rule that says, that a function type inside a function parameter list changes to a pointer to that function type?
c
 |Â
show 1 more comment
up vote
8
down vote
favorite
Compiling with gcc8:
#include <stdio.h>
void some_func(void f1(void), void (*f2)(void))
 printf("%dn", f1);
 printf("%dn", f2);
Gives (only) the following warnings:
<source>:11:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
 printf("%dn", f1);
<source>:12:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
 printf("%dn", f2);
Why is the type of f1 the same as f2? Only f2 is declared as a function pointer. I would expect f1 not to compile at all, as it names a function type, not a function pointer. What is the rule that says, that a function type inside a function parameter list changes to a pointer to that function type?
c
 
 
 1
 
 
 
 
 Answered this on Quora once: quora.com/â¦
 â PSkocik
 2 hours ago
 
 
 
 
 
 
 
 
 
 Regarding the warnings, please use- %pformat specifier when targeting pointers.
 â paddy
 2 hours ago
 
 
 
 
 
 2
 
 
 
 
 @paddy I know, and not really,- %pis only for- void*, so I would need to cast it. The warnings serve only to show to me the deduced by the compiler variable types, not to print the pointers addresses.
 â Kamil Cuk
 2 hours ago
 
 
 
 
 
 
 
 
 
 As a note, just stick to one style, be constant, I prefer the second one but, there is not a clear rule about that.
 â Stargateur
 1 hour ago
 
 
 
 
 
 
 
 
 
 Why? Because the language standard says so.
 â AnT
 1 hour ago
 
 
 
 |Â
show 1 more comment
up vote
8
down vote
favorite
up vote
8
down vote
favorite
Compiling with gcc8:
#include <stdio.h>
void some_func(void f1(void), void (*f2)(void))
 printf("%dn", f1);
 printf("%dn", f2);
Gives (only) the following warnings:
<source>:11:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
 printf("%dn", f1);
<source>:12:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
 printf("%dn", f2);
Why is the type of f1 the same as f2? Only f2 is declared as a function pointer. I would expect f1 not to compile at all, as it names a function type, not a function pointer. What is the rule that says, that a function type inside a function parameter list changes to a pointer to that function type?
c
Compiling with gcc8:
#include <stdio.h>
void some_func(void f1(void), void (*f2)(void))
 printf("%dn", f1);
 printf("%dn", f2);
Gives (only) the following warnings:
<source>:11:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
 printf("%dn", f1);
<source>:12:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
 printf("%dn", f2);
Why is the type of f1 the same as f2? Only f2 is declared as a function pointer. I would expect f1 not to compile at all, as it names a function type, not a function pointer. What is the rule that says, that a function type inside a function parameter list changes to a pointer to that function type?
c
c
edited 1 hour ago


Boann
36.1k1286118
36.1k1286118
asked 2 hours ago
Kamil Cuk
5,8111219
5,8111219
 
 
 1
 
 
 
 
 Answered this on Quora once: quora.com/â¦
 â PSkocik
 2 hours ago
 
 
 
 
 
 
 
 
 
 Regarding the warnings, please use- %pformat specifier when targeting pointers.
 â paddy
 2 hours ago
 
 
 
 
 
 2
 
 
 
 
 @paddy I know, and not really,- %pis only for- void*, so I would need to cast it. The warnings serve only to show to me the deduced by the compiler variable types, not to print the pointers addresses.
 â Kamil Cuk
 2 hours ago
 
 
 
 
 
 
 
 
 
 As a note, just stick to one style, be constant, I prefer the second one but, there is not a clear rule about that.
 â Stargateur
 1 hour ago
 
 
 
 
 
 
 
 
 
 Why? Because the language standard says so.
 â AnT
 1 hour ago
 
 
 
 |Â
show 1 more comment
 
 
 1
 
 
 
 
 Answered this on Quora once: quora.com/â¦
 â PSkocik
 2 hours ago
 
 
 
 
 
 
 
 
 
 Regarding the warnings, please use- %pformat specifier when targeting pointers.
 â paddy
 2 hours ago
 
 
 
 
 
 2
 
 
 
 
 @paddy I know, and not really,- %pis only for- void*, so I would need to cast it. The warnings serve only to show to me the deduced by the compiler variable types, not to print the pointers addresses.
 â Kamil Cuk
 2 hours ago
 
 
 
 
 
 
 
 
 
 As a note, just stick to one style, be constant, I prefer the second one but, there is not a clear rule about that.
 â Stargateur
 1 hour ago
 
 
 
 
 
 
 
 
 
 Why? Because the language standard says so.
 â AnT
 1 hour ago
 
 
 
1
1
Answered this on Quora once: quora.com/â¦
â PSkocik
2 hours ago
Answered this on Quora once: quora.com/â¦
â PSkocik
2 hours ago
Regarding the warnings, please use
%p format specifier when targeting pointers.â paddy
2 hours ago
Regarding the warnings, please use
%p format specifier when targeting pointers.â paddy
2 hours ago
2
2
@paddy I know, and not really,
%p is only for void*, so I would need to cast it. The warnings serve only to show to me the deduced by the compiler variable types, not to print the pointers addresses.â Kamil Cuk
2 hours ago
@paddy I know, and not really,
%p is only for void*, so I would need to cast it. The warnings serve only to show to me the deduced by the compiler variable types, not to print the pointers addresses.â Kamil Cuk
2 hours ago
As a note, just stick to one style, be constant, I prefer the second one but, there is not a clear rule about that.
â Stargateur
1 hour ago
As a note, just stick to one style, be constant, I prefer the second one but, there is not a clear rule about that.
â Stargateur
1 hour ago
Why? Because the language standard says so.
â AnT
1 hour ago
Why? Because the language standard says so.
â AnT
1 hour ago
 |Â
show 1 more comment
 2 Answers
 2
 
active
oldest
votes
up vote
11
down vote
Because the standard (6.7.6.3p8) says that
A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type'', as in 6.3.2.1.
It's similar to how arrays parameters are adjusted to pointers (6.7.63.p7) , if you think about it.
void some_func(void (void));
void some_func(void (*)(void));
are compatible declarations, just like:
void other_func(char string);
void other_func(char *string);
are.
Note that the adjustment doesn't make void some_func(void (*)(void) compatible with void some_other_func(void (**)(void) or void yet_another_func(void (*****)(void) and that as far as functions are concerned, declarations don't really reflect use anymore, (despite that being the intention of the language's original author). In standardized C, due to how function identifiers decay to pointers and due to how it doesn't matter whether you use a function type or a function pointer type to make a call, you can call any function with arbitrarily many *:
#include <stdio.h>
int main()
 (*puts)("hello world");
 (******puts)("hello world");
 (***&*&*puts)("hello world"); //& cancels a * as per 6.5.3.2p3
 int (*p)(char const*) = puts;
 int (**pp)(char const*) = &p;
 int (***ppp)(char const*) = &pp;
 (**ppp)("hello world"); //at least two asterisks required here
add a comment |Â
up vote
0
down vote
Because in C, in that case, the function name itself is a function pointer. See this answer: Why is using the function name as a function pointer equivalent to applying the address-of operator to the function name?
 
 
 
 
 
 
 Then why does- void some_func(void (*****f3)(void))here- f3names a different type then- f1and- f2.
 â Kamil Cuk
 2 hours ago
 
 
 
 
 
 
 
 
 
 I don't see why it should be the same type as- f1or- f2. There is an historical and practical reason why the function name is a pointer to the function itself, like explained in that answer, and I don't see these reasons can be applied to any arbitrary pointer to pointer (...) to function.
 â ad3angel1s
 2 hours ago
 
 
 
 
 
 4
 
 
 
 
 In C, a function name itself is not a function pointer. The function name is an identifier. When used as an expression, it has function type. Per C 6.3.2.1 4, an expression that has function type is called a function designator. When it is not used as the operand of- sizeofor unary- &, then a function designator is converted to a pointer (again by 6.3.2.1 4). I understand you may think of this conversion as so automatic and ubiquitous that one can think of a function name as a pointer, but we are creating a permanent record of technical answers explaining the C standard here.
 â Eric Postpischil
 1 hour ago
 
 
 
 
 
 
 
 
 
 @EricPostpischil does this mean that you can only call only function pointers and not functions? Because- ()operator is not- sizeofor- &.
 â Ajay Brahmakshatriya
 1 hour ago
 
 
 
 
 
 1
 
 
 
 
 @AjayBrahmakshatriya: In a function call expression, such as- SomeExpression(), if the- SomeExpressionis a function designator (any expression that has function type), then it is automatically converted to a pointer to the function. In effect, a âÂÂproperâ way to write a function call such as- f1(3)is- (&f1)(3). When you write- f1(3), the compiler automatically converts it to- (&f1)(3)for you.
 â Eric Postpischil
 1 hour ago
 
 
 
 |Â
show 1 more comment
 2 Answers
 2
 
active
oldest
votes
 2 Answers
 2
 
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
11
down vote
Because the standard (6.7.6.3p8) says that
A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type'', as in 6.3.2.1.
It's similar to how arrays parameters are adjusted to pointers (6.7.63.p7) , if you think about it.
void some_func(void (void));
void some_func(void (*)(void));
are compatible declarations, just like:
void other_func(char string);
void other_func(char *string);
are.
Note that the adjustment doesn't make void some_func(void (*)(void) compatible with void some_other_func(void (**)(void) or void yet_another_func(void (*****)(void) and that as far as functions are concerned, declarations don't really reflect use anymore, (despite that being the intention of the language's original author). In standardized C, due to how function identifiers decay to pointers and due to how it doesn't matter whether you use a function type or a function pointer type to make a call, you can call any function with arbitrarily many *:
#include <stdio.h>
int main()
 (*puts)("hello world");
 (******puts)("hello world");
 (***&*&*puts)("hello world"); //& cancels a * as per 6.5.3.2p3
 int (*p)(char const*) = puts;
 int (**pp)(char const*) = &p;
 int (***ppp)(char const*) = &pp;
 (**ppp)("hello world"); //at least two asterisks required here
add a comment |Â
up vote
11
down vote
Because the standard (6.7.6.3p8) says that
A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type'', as in 6.3.2.1.
It's similar to how arrays parameters are adjusted to pointers (6.7.63.p7) , if you think about it.
void some_func(void (void));
void some_func(void (*)(void));
are compatible declarations, just like:
void other_func(char string);
void other_func(char *string);
are.
Note that the adjustment doesn't make void some_func(void (*)(void) compatible with void some_other_func(void (**)(void) or void yet_another_func(void (*****)(void) and that as far as functions are concerned, declarations don't really reflect use anymore, (despite that being the intention of the language's original author). In standardized C, due to how function identifiers decay to pointers and due to how it doesn't matter whether you use a function type or a function pointer type to make a call, you can call any function with arbitrarily many *:
#include <stdio.h>
int main()
 (*puts)("hello world");
 (******puts)("hello world");
 (***&*&*puts)("hello world"); //& cancels a * as per 6.5.3.2p3
 int (*p)(char const*) = puts;
 int (**pp)(char const*) = &p;
 int (***ppp)(char const*) = &pp;
 (**ppp)("hello world"); //at least two asterisks required here
add a comment |Â
up vote
11
down vote
up vote
11
down vote
Because the standard (6.7.6.3p8) says that
A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type'', as in 6.3.2.1.
It's similar to how arrays parameters are adjusted to pointers (6.7.63.p7) , if you think about it.
void some_func(void (void));
void some_func(void (*)(void));
are compatible declarations, just like:
void other_func(char string);
void other_func(char *string);
are.
Note that the adjustment doesn't make void some_func(void (*)(void) compatible with void some_other_func(void (**)(void) or void yet_another_func(void (*****)(void) and that as far as functions are concerned, declarations don't really reflect use anymore, (despite that being the intention of the language's original author). In standardized C, due to how function identifiers decay to pointers and due to how it doesn't matter whether you use a function type or a function pointer type to make a call, you can call any function with arbitrarily many *:
#include <stdio.h>
int main()
 (*puts)("hello world");
 (******puts)("hello world");
 (***&*&*puts)("hello world"); //& cancels a * as per 6.5.3.2p3
 int (*p)(char const*) = puts;
 int (**pp)(char const*) = &p;
 int (***ppp)(char const*) = &pp;
 (**ppp)("hello world"); //at least two asterisks required here
Because the standard (6.7.6.3p8) says that
A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type'', as in 6.3.2.1.
It's similar to how arrays parameters are adjusted to pointers (6.7.63.p7) , if you think about it.
void some_func(void (void));
void some_func(void (*)(void));
are compatible declarations, just like:
void other_func(char string);
void other_func(char *string);
are.
Note that the adjustment doesn't make void some_func(void (*)(void) compatible with void some_other_func(void (**)(void) or void yet_another_func(void (*****)(void) and that as far as functions are concerned, declarations don't really reflect use anymore, (despite that being the intention of the language's original author). In standardized C, due to how function identifiers decay to pointers and due to how it doesn't matter whether you use a function type or a function pointer type to make a call, you can call any function with arbitrarily many *:
#include <stdio.h>
int main()
 (*puts)("hello world");
 (******puts)("hello world");
 (***&*&*puts)("hello world"); //& cancels a * as per 6.5.3.2p3
 int (*p)(char const*) = puts;
 int (**pp)(char const*) = &p;
 int (***ppp)(char const*) = &pp;
 (**ppp)("hello world"); //at least two asterisks required here
edited 1 hour ago
answered 2 hours ago
PSkocik
28.9k43965
28.9k43965
add a comment |Â
add a comment |Â
up vote
0
down vote
Because in C, in that case, the function name itself is a function pointer. See this answer: Why is using the function name as a function pointer equivalent to applying the address-of operator to the function name?
 
 
 
 
 
 
 Then why does- void some_func(void (*****f3)(void))here- f3names a different type then- f1and- f2.
 â Kamil Cuk
 2 hours ago
 
 
 
 
 
 
 
 
 
 I don't see why it should be the same type as- f1or- f2. There is an historical and practical reason why the function name is a pointer to the function itself, like explained in that answer, and I don't see these reasons can be applied to any arbitrary pointer to pointer (...) to function.
 â ad3angel1s
 2 hours ago
 
 
 
 
 
 4
 
 
 
 
 In C, a function name itself is not a function pointer. The function name is an identifier. When used as an expression, it has function type. Per C 6.3.2.1 4, an expression that has function type is called a function designator. When it is not used as the operand of- sizeofor unary- &, then a function designator is converted to a pointer (again by 6.3.2.1 4). I understand you may think of this conversion as so automatic and ubiquitous that one can think of a function name as a pointer, but we are creating a permanent record of technical answers explaining the C standard here.
 â Eric Postpischil
 1 hour ago
 
 
 
 
 
 
 
 
 
 @EricPostpischil does this mean that you can only call only function pointers and not functions? Because- ()operator is not- sizeofor- &.
 â Ajay Brahmakshatriya
 1 hour ago
 
 
 
 
 
 1
 
 
 
 
 @AjayBrahmakshatriya: In a function call expression, such as- SomeExpression(), if the- SomeExpressionis a function designator (any expression that has function type), then it is automatically converted to a pointer to the function. In effect, a âÂÂproperâ way to write a function call such as- f1(3)is- (&f1)(3). When you write- f1(3), the compiler automatically converts it to- (&f1)(3)for you.
 â Eric Postpischil
 1 hour ago
 
 
 
 |Â
show 1 more comment
up vote
0
down vote
Because in C, in that case, the function name itself is a function pointer. See this answer: Why is using the function name as a function pointer equivalent to applying the address-of operator to the function name?
 
 
 
 
 
 
 Then why does- void some_func(void (*****f3)(void))here- f3names a different type then- f1and- f2.
 â Kamil Cuk
 2 hours ago
 
 
 
 
 
 
 
 
 
 I don't see why it should be the same type as- f1or- f2. There is an historical and practical reason why the function name is a pointer to the function itself, like explained in that answer, and I don't see these reasons can be applied to any arbitrary pointer to pointer (...) to function.
 â ad3angel1s
 2 hours ago
 
 
 
 
 
 4
 
 
 
 
 In C, a function name itself is not a function pointer. The function name is an identifier. When used as an expression, it has function type. Per C 6.3.2.1 4, an expression that has function type is called a function designator. When it is not used as the operand of- sizeofor unary- &, then a function designator is converted to a pointer (again by 6.3.2.1 4). I understand you may think of this conversion as so automatic and ubiquitous that one can think of a function name as a pointer, but we are creating a permanent record of technical answers explaining the C standard here.
 â Eric Postpischil
 1 hour ago
 
 
 
 
 
 
 
 
 
 @EricPostpischil does this mean that you can only call only function pointers and not functions? Because- ()operator is not- sizeofor- &.
 â Ajay Brahmakshatriya
 1 hour ago
 
 
 
 
 
 1
 
 
 
 
 @AjayBrahmakshatriya: In a function call expression, such as- SomeExpression(), if the- SomeExpressionis a function designator (any expression that has function type), then it is automatically converted to a pointer to the function. In effect, a âÂÂproperâ way to write a function call such as- f1(3)is- (&f1)(3). When you write- f1(3), the compiler automatically converts it to- (&f1)(3)for you.
 â Eric Postpischil
 1 hour ago
 
 
 
 |Â
show 1 more comment
up vote
0
down vote
up vote
0
down vote
Because in C, in that case, the function name itself is a function pointer. See this answer: Why is using the function name as a function pointer equivalent to applying the address-of operator to the function name?
Because in C, in that case, the function name itself is a function pointer. See this answer: Why is using the function name as a function pointer equivalent to applying the address-of operator to the function name?
edited 1 hour ago
answered 2 hours ago
ad3angel1s
314112
314112
 
 
 
 
 
 
 Then why does- void some_func(void (*****f3)(void))here- f3names a different type then- f1and- f2.
 â Kamil Cuk
 2 hours ago
 
 
 
 
 
 
 
 
 
 I don't see why it should be the same type as- f1or- f2. There is an historical and practical reason why the function name is a pointer to the function itself, like explained in that answer, and I don't see these reasons can be applied to any arbitrary pointer to pointer (...) to function.
 â ad3angel1s
 2 hours ago
 
 
 
 
 
 4
 
 
 
 
 In C, a function name itself is not a function pointer. The function name is an identifier. When used as an expression, it has function type. Per C 6.3.2.1 4, an expression that has function type is called a function designator. When it is not used as the operand of- sizeofor unary- &, then a function designator is converted to a pointer (again by 6.3.2.1 4). I understand you may think of this conversion as so automatic and ubiquitous that one can think of a function name as a pointer, but we are creating a permanent record of technical answers explaining the C standard here.
 â Eric Postpischil
 1 hour ago
 
 
 
 
 
 
 
 
 
 @EricPostpischil does this mean that you can only call only function pointers and not functions? Because- ()operator is not- sizeofor- &.
 â Ajay Brahmakshatriya
 1 hour ago
 
 
 
 
 
 1
 
 
 
 
 @AjayBrahmakshatriya: In a function call expression, such as- SomeExpression(), if the- SomeExpressionis a function designator (any expression that has function type), then it is automatically converted to a pointer to the function. In effect, a âÂÂproperâ way to write a function call such as- f1(3)is- (&f1)(3). When you write- f1(3), the compiler automatically converts it to- (&f1)(3)for you.
 â Eric Postpischil
 1 hour ago
 
 
 
 |Â
show 1 more comment
 
 
 
 
 
 
 Then why does- void some_func(void (*****f3)(void))here- f3names a different type then- f1and- f2.
 â Kamil Cuk
 2 hours ago
 
 
 
 
 
 
 
 
 
 I don't see why it should be the same type as- f1or- f2. There is an historical and practical reason why the function name is a pointer to the function itself, like explained in that answer, and I don't see these reasons can be applied to any arbitrary pointer to pointer (...) to function.
 â ad3angel1s
 2 hours ago
 
 
 
 
 
 4
 
 
 
 
 In C, a function name itself is not a function pointer. The function name is an identifier. When used as an expression, it has function type. Per C 6.3.2.1 4, an expression that has function type is called a function designator. When it is not used as the operand of- sizeofor unary- &, then a function designator is converted to a pointer (again by 6.3.2.1 4). I understand you may think of this conversion as so automatic and ubiquitous that one can think of a function name as a pointer, but we are creating a permanent record of technical answers explaining the C standard here.
 â Eric Postpischil
 1 hour ago
 
 
 
 
 
 
 
 
 
 @EricPostpischil does this mean that you can only call only function pointers and not functions? Because- ()operator is not- sizeofor- &.
 â Ajay Brahmakshatriya
 1 hour ago
 
 
 
 
 
 1
 
 
 
 
 @AjayBrahmakshatriya: In a function call expression, such as- SomeExpression(), if the- SomeExpressionis a function designator (any expression that has function type), then it is automatically converted to a pointer to the function. In effect, a âÂÂproperâ way to write a function call such as- f1(3)is- (&f1)(3). When you write- f1(3), the compiler automatically converts it to- (&f1)(3)for you.
 â Eric Postpischil
 1 hour ago
 
 
 
Then why does
void some_func(void (*****f3)(void)) here f3 names a different type then f1 and f2.â Kamil Cuk
2 hours ago
Then why does
void some_func(void (*****f3)(void)) here f3 names a different type then f1 and f2.â Kamil Cuk
2 hours ago
I don't see why it should be the same type as
f1 or f2. There is an historical and practical reason why the function name is a pointer to the function itself, like explained in that answer, and I don't see these reasons can be applied to any arbitrary pointer to pointer (...) to function.â ad3angel1s
2 hours ago
I don't see why it should be the same type as
f1 or f2. There is an historical and practical reason why the function name is a pointer to the function itself, like explained in that answer, and I don't see these reasons can be applied to any arbitrary pointer to pointer (...) to function.â ad3angel1s
2 hours ago
4
4
In C, a function name itself is not a function pointer. The function name is an identifier. When used as an expression, it has function type. Per C 6.3.2.1 4, an expression that has function type is called a function designator. When it is not used as the operand of
sizeof or unary &, then a function designator is converted to a pointer (again by 6.3.2.1 4). I understand you may think of this conversion as so automatic and ubiquitous that one can think of a function name as a pointer, but we are creating a permanent record of technical answers explaining the C standard here.â Eric Postpischil
1 hour ago
In C, a function name itself is not a function pointer. The function name is an identifier. When used as an expression, it has function type. Per C 6.3.2.1 4, an expression that has function type is called a function designator. When it is not used as the operand of
sizeof or unary &, then a function designator is converted to a pointer (again by 6.3.2.1 4). I understand you may think of this conversion as so automatic and ubiquitous that one can think of a function name as a pointer, but we are creating a permanent record of technical answers explaining the C standard here.â Eric Postpischil
1 hour ago
@EricPostpischil does this mean that you can only call only function pointers and not functions? Because
() operator is not sizeof or &.â Ajay Brahmakshatriya
1 hour ago
@EricPostpischil does this mean that you can only call only function pointers and not functions? Because
() operator is not sizeof or &.â Ajay Brahmakshatriya
1 hour ago
1
1
@AjayBrahmakshatriya: In a function call expression, such as
SomeExpression(), if the SomeExpression is a function designator (any expression that has function type), then it is automatically converted to a pointer to the function. In effect, a âÂÂproperâ way to write a function call such as f1(3) is (&f1)(3). When you write f1(3), the compiler automatically converts it to (&f1)(3) for you.â Eric Postpischil
1 hour ago
@AjayBrahmakshatriya: In a function call expression, such as
SomeExpression(), if the SomeExpression is a function designator (any expression that has function type), then it is automatically converted to a pointer to the function. In effect, a âÂÂproperâ way to write a function call such as f1(3) is (&f1)(3). When you write f1(3), the compiler automatically converts it to (&f1)(3) for you.â Eric Postpischil
1 hour ago
 |Â
show 1 more comment
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52996650%2fwhy-can-be-omitted-from-a-function-pointer-inside-a-function-parameter-lis%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Answered this on Quora once: quora.com/â¦
â PSkocik
2 hours ago
Regarding the warnings, please use
%pformat specifier when targeting pointers.â paddy
2 hours ago
2
@paddy I know, and not really,
%pis only forvoid*, so I would need to cast it. The warnings serve only to show to me the deduced by the compiler variable types, not to print the pointers addresses.â Kamil Cuk
2 hours ago
As a note, just stick to one style, be constant, I prefer the second one but, there is not a clear rule about that.
â Stargateur
1 hour ago
Why? Because the language standard says so.
â AnT
1 hour ago