(no title)
cpburns2009 | 1 month ago
> auto main() -> int
Isn't that declaring the return type twice, once as auto and the other as int?
cpburns2009 | 1 month ago
> auto main() -> int
Isn't that declaring the return type twice, once as auto and the other as int?
yunnpp|1 month ago
There is, however, a return type auto-deduction in recent standards iirc, which is especially useful for lambdas.
https://en.cppreference.com/w/cpp/language/auto.html
auto f() -> int; // OK: f returns int
auto g() { return 0.0; } // OK since C++14: g returns double
auto h(); // OK since C++14: h’s return type will be deduced when it is defined
maccard|1 month ago
auto g() -> auto { return 0.0; }
maccard|1 month ago
zabzonk|1 month ago