Pages

Hello CLI

The code we are talking about here is not proper C++, it is C++/CLI, where CLI stands for Common Language Infrastructure, and that means .NET, so we are basically talking about the C++ twisted by Microsoft to fit in its propertary architecture.

The cool thing about C++/CLI is that it is a superset of the standard C++, so we could, in principle, just avoid CLI and developing (more or less) pure C++ for our Windows platform.

Here is the usual hello program written in a way to show how C++/CLI could use C, C++ and CLI features:

#include <stdio.h>
#include <iostream>

int main()
{
printf("hello"); // C
std::cout << ", "; // C++
System::Console::WriteLine("world"); // CLI

system("pause");
}

Isn't that too bad, is it?

This post is based on my reading on the book "Expert C++/CLI: .NET for Visual C++ Programmers" by Marcus Heege, APress. I suggest you to read it too, to have more details on the matter

No comments:

Post a Comment