Skip to content

Comment on The C Programming Language - Part 0

Comments

I hope one of the parts deals with people's aversion to C declarations. The declaration syntax allows vastly complicated data definition, and the fact that declaration looks like use simplifies things immensely.

(I also have a personal style quibble -- lots of people seem to think that putting spaces around every lexical element clarifies things; I think it just makes gassy code.)

As a fan of C, I have to disagree. To quote OS X's `man signal`:

    void (*signal(int sig, void (*func)(int)))(int);

    or in the equivalent but easier to read typedef'd version:

    typedef void (*sig_t) (int);
    sig_t signal(int sig, sig_t func);
In, say, Go, this would be
    func signal(sig int, newFunc func(int)) func(int)
which imo is cleaner (it's clear that the second argument and return value have the same type, without having to use a typedef) without sacrificing power.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.