3 ms·
Why some functions are declared like: void foo() { .. } And others auto foo() -> void { .. }
by ithkuil 4y ago
Why some functions are declared like:
void foo() { .. }
And others
auto foo() -> void { .. }
- pjmlp 4y agoFashion. The second syntax was introduced for lambdas and decltype() usage for return types that depend on the parameters (due to look up rules), and some C++ subcultures now use it everywhere.
- zoomablemind 4y ago>...And others > auto main() -> int { Absolutely no reason to masquerade main() in such a fashion! It's a rule of least surprise, be it for user or fellow developer.