Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
4.4.3
-
None
Description
The C/C++ runtime in Visual Studio supports an alternative "int wmain(int argc, wchar_t * argv[])" entry point. It can be used in ordinary win32 console applications. GUI applications can use the Unicode aware wWinMain entry point.
A Qt application (Windows only, as wmain is not portable) is forced to use the classic main() entry point. Therefore, to obtain the Unicode version of the command-line arguments, either QCoreApplication::arguments() has to be used, which is slow and requires the QCoreApplication/QApplication to be instantiated (which can be a problem, if the main application class derives from QApplication and performs some lengthy initialization or tasks, which are not desirable, in case the application only wants to notify a previous running instance and quit immediately).
Or the other way is to call GetCommandLineW() & CommandLineToArgvW() APIs. In either case, both the ANSI and Unicode versions of the command-line arguments are populated, which is not efficient.
The suggestion is that it might be useful to take advantage of the built-in Unicode aware wmain() entry point support offered by the Visual Studio CRT.