Why does the C++ "Hello World" project generated by Visual Studio look a little strange?
I'm new to C++ programming (although I have experience in J开发者_如何学Cava, C#, and Visual Basic). I have used Visual Studio 2010 to create a default "Hello World" example project, but when I investigate the sample code it generates, it looks a little bit different from the code that I see when looking at C++ tutorials.
In my investigations, I've learned that there are two versions of C++, or at least two different standards. I think they're called CLR and CLI. What standard or version must I learn to program further in the future?
There's regular, plain-old, ISO-standards-based C++ which is probably the kind you're seeing in tutorials. If you want to write Windows applications in regular C++, you will probably be targeting the Win32 API (or using a set of classes that wrap the basic functionality of the Win32 API, such as MFC).
Then there's C++/CLI, which can almost be thought of as an entirely new language (albeit a superset of C++) that includes Microsoft's extensions in order to support the .NET Framework. It is standardized as ECMA-372. The .NET Framework runs on top of the CLR, so the version of C++ that is compatible with the CLR is called "C++/CLI".
You probably want to ignore the C++/CLI variant of the language right now entirely. It's really only useful in interoperability scenarios with .NET code. Since you appear to want to learn C++, the extra CLI stuff is just going to be a confusing distraction. You want to learn real C++, not the .NET Framework grafted on top of C++. If you want to learn .NET, start with either C# or VB.NET, instead.
A bit more information on the distinction between C++ and C++/CLI is available in my answer here.
c++/cli is a dotNET-based language, depending on the CLR.
C++ is defined by an ISO Standard, and should not be confused with microsoft's c++/CLI
If you wish to work with a dotNET-based language, learn C# not C++/CLI. Most likely your tutorials are for regular C++ - this is a lot more common than C++/CLI. Visual Studio works well with either standard C++ or C++/CLI, you select which to use when creating a project.
精彩评论