|
|
|
|
|
by swhipple
3437 days ago
|
|
That's interesting -- I was wondering in which cases typedef changes the parse tree, and came across a few [1]: a (b); /* function call or declaration */
a * b; /* multiplication or declaration */
f((a) * b); /* multiplication or deref and cast */
> With one further change, namely deleting the production typedef-name: identifier and making typedef-name a terminal symbol, this grammar is acceptable to the YACC parser-generator.[1] http://eli.thegreenplace.net/2007/11/24/the-context-sensitiv... |
|
This is especially fun to deal with for C++ IDEs that support semantic highlighting (i.e. typenames are in a different color etc). If I remember correctly, the first one that could handle this right was VS 2012 - it only took 14 years after ISO C++ standard was released...