You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are other similar situations where the parser assumes that abc is an identifier and not a type:
a = (abc)*x;
a = (abc)&x;
a = (abc)-x;
The problem is that C grammar is ambiguous here, confounding syntax and semantic. For example, the first one can be either a cast followed by a dereference, or a multiplication, purely based on whether abc is a type or a variable. The parser should know if abc has been previously typedef'd, and choose the correct interpretation. But apparently it doesn't.
I'm sorry but yeah C is too ambiguous here. One solution is to just somewhat follow convention where types are oftentimes PascalCase identifiers and variables snake_case or camelCase, this can easily be done with queries.
The following three cases create
cast_expression
nodes.However, if using a custom type and using
()
, we end up with acall_expression
which is wrong.The text was updated successfully, but these errors were encountered: