Hacker News new | past | comments | ask | show | jobs | submit login

C++ ends up with three forms (of course it does):

Normal C style declaration

    int foo() { return 2; }
Trailing return type. Useful when the return type depends on the parameter types, or is inside the namespace of the function

    auto foo() -> int { return 2; }
Automated type deduction. Increasingly the choice when possible

    auto foo() { return 2; }



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: