Posted Jan 28, 2010 17:09 UTC (Thu) by tjc
In reply to: Syntax flubs
Parent article: GCC to merge Go support
Could you comment on why should postfix be deemed superior?
You didn't ask me, but that didn't stop anyone else, so here I go. :-)
As a real-world example, here's the prototype for the Unix signal function:
void (*signal(int sig, void (*disp)(int)))(int);
Here it is again with postfix pointer notation:
void signal(int sig, void disp*(int)) *(int);
This is left-to-right-- with the exception of the base types-- so it's easier to read, at least for me.
Here it is again, with the base types left-to-right:
func signal(sig int, disp*(int) void) *(int) void;
This requires using a declarator like "func" so that the parser can figure out what is going on.
to post comments)