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

Some of C's syntax is distinctly kooky, particularly declarations. By way of illustration, my two favourite C declarations:

    const struct strange typedef volatile;
    typedef evil;
Or the following, in which the struct tag is a forward declaration, but only within the declaration, and only if the struct has not already been declared:

    void func(struct odd);
There's no good reason for the declaration syntax to have so many meaningless edge cases. It simply was not designed very well.

Then there's the other odd bits of C syntax: & and | have the wrong precedence, variables are bound inside their own initialisation forms, labels can appear in bizarre places but can't appear at the end of a compound statement, case statements can be interleaved with other control structures, etc. And there's the preprocessor.

None of this stuff has done much damage to C's success, but let's not pretend that the language is free from quirks and corner cases.



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

Search: