Differences between C ++ and c ++ / cli

1

I am trying to make a windows form, and searching the web, I have seen that it is the c ++ / cli language, but I do not understand very well what this means. As I understand, it is a modification of c ++ by Windows, but I do not find any relationship with the standard language, since if I want to print by console in c ++ I would use std::cout << "Hola mundo" and in c ++ / cli it would be Console::WriteLine("Hola Mundo");

Why, if it has such a different syntax, is it considered part of the same language (an extension or a modification)?

    
asked by Jogofus 07.07.2017 в 00:28
source

1 answer

2

C ++ is a native language (an executable binary is generated). C ++. Net is a language based on virtual machine (it is part of the .Net family). In this case, the compiler does not generate executable code but rather a sort of intermediate code that is processed by the .Net virtual machine during program execution. This virtual machine is responsible for converting that intermediate code into executable binary.

The .Net version of C ++ is not a pure C ++ but is a free version of the language that has been adapted to be compatible with the .Net infrastructure.

Portability:

  • The binary generated with C ++ can only be executed on the target machine (the binary is not portable from windows to linux, for example)
  • The code generated by C ++. Net can be executed on any system that has a .Net installation

Reverse engineering:

  • The binary generator by C ++ has a complicated reverse engineering since the class structure can disappear completely and the architecture of the system is reduced to a set of functions. The code generated by C ++. Net can be decompiled with some ease, getting to get the names of functions, variables and system architecture. When working with .Net it is normal to pass some type of obfuscator that complicates the inverse engineering.

Licenses:

  • When working with C ++ you have very good open source compilers at your disposal. You can also choose payment solutions
  • C ++. Net, because it is anchored to .Net, has few options of choice and almost all of them use the Microsoft compiler or the one that provides the MONO project. Typically you end up subject to Microsoft licenses.

Base library:

  • The standard C ++ library, although it has quite powerful features, is insufficient for a serious project. With the entry of the latest standards a great effort has been made to incorporate basic elements to this library but it still has many shortcomings.
  • .Net offers the programmer an extensive catalog of libraries that allow real wonders (graphic interface, cryptography, sockets, access to databases, printing services, ...)

And the thing continues ...

As you can see, the differences are remarkable and the choice of one or another alternative will completely mark the way to develop your projects.

    
answered by 07.07.2017 / 09:05
source