3 ms·
Every other value declaration in C is <type> <name>, but function pointer values are different because the name to which its bound is right in the middle of the
by naasking 10y ago
Every other value declaration in C is <type> <name>, but function pointer values are different because the name to which its bound is right in the middle of the type. I understand the historical reasons, but it's unnecessarily obtuse, and this fixes that. Declarations of function pointer values are now just like any other value.
The macro can't expand to a raw function pointer type without including the name to which it's bound in the macro arguments, once again introducing this obtuseness. Even worse actually, because the bound name is now indistinguishable from the types, where the ordinary syntax, while noisy, clearly distinguishes names from types.
This style also matches the closure declaration style, ie. clo(T0, T1, ...), thus providing a seemless transition from function pointer values to actual function values which can carry environments.
- gpderetta 10y agoOh, right, now I get it. Another option is for the macro to define a separate function type typedef (properly mangled with the line number) for the function type and then use it to define a pointer to it.