I am a c# programmer but today i am thinking of migrating to c++, The first thing i wonder about is that there is 2 types of projects CLR Console Application and Win32 Console Application
Also what confuses me is that in Win32 i can write line to console using either printf or cout
while in CLR i can also use the familiar Console::WriteLine
i am totally confused what is the point of having all that functions just to write a line and what is the difference between the CLR and Win32 Applications
printfis the C way. It isn’t typesafe, but it’s fast. It runs on the standard C library. (C++ can do this, but it’s not normal.)coutis the C++ way. It’s typesafe, and is the normal way in C++. It runs on the standard C++ library.WriteLineis the .Net way, and thus the C++/CLI way. It runs on the .Net library.WriteConsoleis the Windows way. It’s a raw operating system call, so is fast, but it’s hard to use and not portable. Don’t use this.As for comparing the languages, C is a less complicated language (making your code more complicated), but C++ has templates, so they’re roughly equivalent in speed, depending on the task. They’re normal Win32 applications, which means they’re pre-complied to raw machine code, and directly run by the processor. C++/CLI runs atop the .Net framework, which means it’s compiled as it’s being run by the .Net framework, and it tends to run slower than C or C++.
Take all this with a grain of salt.
WriteConsolecan do things the others can’t easily do. The .Net framework is amazingly fast at certain things. But in general, use the version associated with your lanugage.