Follow

@cancel i'm totally conflicted on this. Left-pointers make more sense (the * is part of the type declaration), but it just looks so weird for some reason.

@buzzert actually, right pointers make more sense :/

int *a, *b;

But I find left pointers easier to read for the more common cases... but they're technically not how the C grammar actually works.

@cancel I meant makes more sense in that the type of `int* a` is "pointer to int" not "int", so the `*` should be lumped together with `int` instead of the variable (imo).

Most compiler folks seem to agree using `*` in the grammar was probably a mistake though. I like how modern languages with generics can do things like `pointer<int>` instead now.

@buzzert oh yeah, it was totally a mistake. I don't think languages did it before or after. (Except when intentionally copying C.)

And yeah, I know what you're saying. The * is part of the type of the thing, even though the grammar says it needs to be alongside the name when it's declared like that (like with the multiple-pointers declaration.)

Which is why I find it easier to read when it's left-aligned, with the rest of the type stuff. Alas...

Sign in to participate in the conversation
Merveilles

Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them. Check out our Patreon to see our donations.