Skip to content

Comment on The C Programming Language - Part 0parent

Comments

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.