Re:Name before type: why ‘age int’ is better than ‘int age’
by Someone on Sunday August 06, 2023 @04:46PM
(#37026532)
FTA: “In C, the following declares x to be a pointer, but (surprisingly at first!) y to be a normal integer:
int* x, y;
Whereas the equivalent in Go does what you’d expect, declaring both to be pointers:
var x, y *int
”*
I don’t see how that’s an argument in favour of `age int` over `int age`. Both C could easily have picked the alternative semantics. Go could have, too:
var x*, y* int; // two pointers
var x, y* int; // x is an int, y a pointer to int
or
var *x, *y int; // two pointers
var x, *y int; // x is an int, y a pointer to int
I don’t see how that’s an argument in favour of `age int` over `int age`. Both C could easily have picked the alternative semantics. Go could have, too:
or