News for hackers. Stuff that matters.
Re:Language Design: Use 'ident: Type' not 'Type ident' by a1369209993 on Saturday May 02, 2020 @01:45AM (#23049590)
There are four possible spacings to consider:

  foo*bar; // multiplies foo and bar
  foo* bar; // declares bar as pointer-to-foo
  foo *bar; // declares *bar as foo (so bar is still a foo*)
  foo * bar; // multiplies foo and bar
These are all unambigous and there are only two semantics between them. You also have:

  foo* bar,baz; // baz is a pointer
  foo *bar,baz; // baz is a foo
  foo *bar,*baz; // baz is pointer again
  foo* bar,*baz; // baz is now a pointer *to* a pointer
This is all obvious - or at worst unambigous - to a person reading the actual code (without trying to correct for the idiosyncracies of a parser), so the language should either match that or spit out a warning about unsupported spacing.

> [`int c = x*y;` is] wrong.

No, that's unambigously multiplication.

There are no comments on this comment yet.