3 ms·
Well, note that partly due to the way variables and functions are declared in C and C++, parsing those languages (especially C++) is a complete mess. I think t
by mikebenfield 4y ago
Well, note that partly due to the way variables and functions are declared in C and C++, parsing those languages (especially C++) is a complete mess.
I think the readability argument is pretty subjective. Personally I find declarations in for instance Rust a lot easier to quickly scan than C++. For one thing the names of functions are all at the same offset, which to me is actually the most important thing. I can see at a glance whether it's a function or variable being declared. I've never found the fact that the return type is at the end to be a problem - why would it be?
fn first_function(...) -> i32 { ... }
fn second_function(...) -> Vec<i32> { ... }
const X: i32 = 0;
vs
int first_function(...) { ... }
vector<int> second_function(...) { ... }
int X = 0;