Re:C++ Internals: STL Vector, Part 3
by AdieuToLogic on Monday August 10, 2015 @12:30AM
(#10032656)
> In addition, it's also more consistent with lambda syntax, lets you use decltype on parameter arguments, allows your function names to line up nicely in header files...
Great points for the repurposing of auto present in the latest standard... Not for use in defining main.
Your case regarding Windows and wrapping main I'm sure is valid. But is not the case with the article's definition.
I do kind of wish you could say "function" instead of "auto" here, but of course that wasn't a reserved keyword so it would have broken existing code.
For the ubiquitous main, "auto main() {}" return type deduction works pretty well. But I need a wrapper around main() anyway thanks to Windows corrupting argv[] when you pass in non-ANSI (Unicode) characters. So for my case, I have:
Where internally, the real main() will use CommandLineToArgvW + WideCharToMultiByte on Windows to return UTF-8 arguments. So many cross-platform apps skip this step, and make opening files named in other languages impossible via command-line.