|
|
|
|
|
by paulnechifor
3442 days ago
|
|
The "spiral rule" doesn't work all the time. See this previous HN comment by
stephencanon: https://news.ycombinator.com/item?id=12775862 . Also this comment by Linus Torvalds (copy pasted because I don't know how to link to Google+ comments): > I don't think that works. It breaks trivially for consecutive [] or * cases, something that he carefully didn't have in his examples. > So the examples were made up to make it look like it's a spiral, but type parsing is about precedence, not about spirals. It so happens that the higher-precedence operators ([] and ()) are on the right-hand side, which is why it "works" to start on the right. > And it doesn't explain why > typedef int (fn_t[][2])(void); > is ok, but > typedef int (fn_t[2][])(void); > is not. > "Spirals"? I don't think so. |
|