4 ms·
Why put the astrisk on the variable though? It’s part of its type, isn’t?
by tobyhinloopen 6y ago
Why put the astrisk on the variable though? It’s part of its type, isn’t?
- bigdict 6y agohttps://eigenstate.org/notes/c-decl https://eigenstate.org/notes/c-decl
- stephencanon 6y agoBecause in the C (and C++) grammar, int *a, b; declares a pointer-to-int `a` and an int `b`, rather than two pointers-to-int. The better solution to this problem is "don't do that", but C (and C++) programmers have a fetish for terseness.
- secondcoming 6y ago> but C (and C++) programmers have a fetish for terseness. Indeed, Linus Torvalds has a recent rant about people still adhering to max 80-column width code. It's pointless in the day of massive monitors.
- qppo 6y agoI use a rather large 4K monitor as my daily driver and maintain 80 column width code where possible, to avoid wraparound when I have many windows open. It's not pointless unless you're using your massive monitor like you did your tiny one thirty years ago. I use mine like a bunch of tiny monitors, not one big one.