is there a purpose for having auto main() -> int
rather than just int main()
? int main()
is less characters, but I see a lot of modern cpp examples using the former rather than the latter. Is there some sort of benefit to this?
is there a purpose for having auto main() -> int
rather than just int main()
? int main()
is less characters, but I see a lot of modern cpp examples using the former rather than the latter. Is there some sort of benefit to this?
“I see a lot of modern cpp projects using the former rather than the latter.” Do you? Can you point some out?
In C++ projects from TypeScript programmers, maybe.
There is no purpose. It is just a preference that some C++ programmers have for one over the other. Both mean the same thing.
It’s also often just a way to show off “I know c00l C++ codez” stuff.
Some people belive that consistency is the most important thing in a program (an OCD effect, possibly). So if you have to use a trailing return type in a few cases, you just use it everywhere. Problem solved!
Show 2 more comments