News for hackers. Stuff that matters.
Re:Building a C Compiler Type System – Part 1: The Formidabl... by Mikhail_Edoshin on Friday July 08, 2016 @03:33AM (#12054066)
What about function declarations? If a function returns a pointer, will you stick the asterisk to the function name? And in a declaration you may omit parameter names entirely, so there's nothing to stick the asterisk to:

    Foo* bar(Baz*, Qux*, int, int*, int**);
I myself do it differently depending on the context. In functions I always stick the asterisk to the type, but if I declare variables, I stick it to the name:

    Foo* bar(Baz* baz) {
       Foo *a, b; Baz c, *d;
       ...
    }
Re:Building a C Compiler Type System – Part 1: The Formidabl... by bluetomcat on Friday July 08, 2016 @04:12AM (#12054171)
The same reasoning applies to function declarations returning pointers:

    int *f(void); // "*f()" returns "int" and "f()" returns "int *"
My habit is to always put a space between the type and the asterisk, regardless of whether there is an identifier:

    sizeof(int *);
    x = (char *) y;