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

I've always found it unsurprising that people find typedefs confusing. They're a storage specifier, which allows for some questionable constructs:

    int typedef x;
    typedef what;
    struct { int x; } typedef *x, y;
    enum { x } typedef;
Storage specifiers are pretty weird. This nonsense is allowed at function or parameter list scope, but not file scope:

    void f() { enum { x } register; }
    void f(enum { x } register);
I've never understood why Ritchie designed C's declaration syntax to have so many dumb edge cases.


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: