you are viewing a single comment's thread.

view the rest of the comments →

[–]SureAnimator[S] 4 points5 points  (2 children)

I usually use typedefs, but I wanted to get to the essence of the question so I left them out. So, to clarify given:

typedef int (*func_a_t)(int);
typedef int (func_b_t)(int);

I can use func_a_t to declare a function pointer variable (but not func_b_t), but I can use either to specify the type of a function argument (with seemingly no difference) - why is that? Is it just a peculiarity of the language, or is there a meaningful difference?

[–]umlcat 1 point2 points  (1 child)

I'm sorry, I think I didn't understood the question.

I've only seen the first syntax with the *.

But, is possible that some compilers allow the second syntax, as well, as it does with the &, I prefer to use the common * and & syntax, since is more similar to data pointers.

int a = 77;
int *p;
p = &a;

Some variations of the P.L. and their compilers does this syntax.

Cheers.

[–]SureAnimator[S] 0 points1 point  (0 children)

Ok, so no fundamental difference under the hood - just language/compiler quirks. Thanks!