Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The C approach makes the compiler much more complex, and introduces extra typing in other language constructs. (like parens around if statements) This is why many newer languages do something more like the Rust way. Overall it is simpler for programmer and compiler.


Pretty much. The mere existence of cdecl(1) says a lot about the simplicity of C's type declaration syntax.


It's unfortunate that the simple (and easy) underlying principles are not well known. See my other comment.

The bigger reason why recent languages have different declaration syntax is to avoid the need to carry a symbol table during parsing, and to avoid the need to parse all files serially instead of independently. Because to recognize a declaration the parser has to know which words correspond to types in the current scope.


I don't think parentheses around if-conditions are related to C variable declarations (if that's what you were saying), and I think it's fair to say that C's syntactical terseness is unmatched.

The parentheses are required to separate the condition from the following conditional statement.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: