2 ms·
Other than its ubiquity, there are lots of bad thigns about C's syntax: * Assignment as an expression is bug-prone * The precedence for the binary operators i
by ufo 9y ago
Other than its ubiquity, there are lots of bad thigns about C's syntax:
* Assignment as an expression is bug-prone
* The precedence for the binary operators is wonky
* Optional braces in if statements make the grammar ambiguous and is also bug prone (the infamous Apple goto bug)
* The type-declaration syntax is convoluted and people need tools like cdecl to understand the more tricky ones.
* The cast syntax is ambiguous and resolving this ambiguity relies on adding dirty hacks to the lexer to tell the parser about type names.
- p0nce 9y ago> Assignment as an expression is bug-prone Can be fixed without syntax change other than returning void. > The precedence for the binary operators is wonky But that's the precedence everyone is accustomed with. D enhance this by forbidding some non-parenthesized dangerous expressions. > Optional braces in if statements make the grammar ambiguous and is also bug prone (the infamous Apple goto bug) I've definately seen such bugs. > The type-declaration syntax is convoluted and people need tools like cdecl to understand the more tricky ones. This is fixed in languages that still feel C-like in syntax. > The cast syntax is ambiguous and resolving this ambiguity relies on adding dirty hacks to the lexer to tell the parser about type names. Yup.