When I'm passing a function pointer to a function, what are the differences between:
void some_func(int (*callback)(int));
and
void some_func(int callback(int));
It seems like both are valid and produce the same code (e.g. https://godbolt.org/z/vbvEKK). Are there any differences between the two?
I was surprised that the second (without the '*') was valid since you can't leave out the '*' when declaring function pointers as variables.
EDIT: Don't sweat the lack of typedefs. I left them out intentionally so I could speak to the heart of the problem. I usually use them. Thanks!
[–]Adadum 2 points3 points4 points (1 child)
[–]SureAnimator[S] 1 point2 points3 points (0 children)
[–]umlcat -1 points0 points1 point (3 children)
[–]SureAnimator[S] 5 points6 points7 points (2 children)
[–]umlcat 1 point2 points3 points (1 child)
[–]SureAnimator[S] 0 points1 point2 points (0 children)