Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between ANSI/ISO C++ and C++/CLI?

Tags:

c++

c++-cli

Created by Microsoft as the foundation of its .NET technology, the Common Language Infrastructure (CLI) is an ECMA standard (ECMA-335) that allows applications to be written in a variety of high-level programming languages and executed in different system environments. Programming languages that conform to the CLI have access to the same base class library and are capable of being compiled into the same intermediate language (IL) and metadata. IL is then further compiled into native code particular to a specific architecture.

Because of this intermediate step, applications do not have to be rewritten from scratch. Their IL only needs to be further compiled into a system's native code.

What exactly is meant by the system environments?


Additionally, while studying Ivor Horton's Beginning Visual C++ 2008, I noticed that he stated that there are fundamentally different kinds of C++ applications can be developed with Visual C++ 2008. These are:

  1. Applications which execute natively on one's computer, which he referred to as native C++ programs. Native C++ programs are written in the version of C++ that is defined by the ISO/ANSI language standard.

  2. Application can also be written to run under the control of the CLR in an extended version of C++, called C++/CLI. These programs were referred to as CLR programs, or C++/CLI programs.

So what is meant by native C++ programs and CLR programs? What's the difference between them? Thanks for any expert's help.

like image 528
caramel1995 Avatar asked Dec 28 '09 11:12

caramel1995


People also ask

Is ANSI C and C the same?

ANSI C merely refers to a particular standard for the C Programming Language - i.e. there is no difference, they refer to the same thing.

What is the difference between ANSI C and Turbo C?

C is a general-purpose programming language. C is one of the oldest currently used programming languages and is one of the most widely used programming languages. ANSI C is a set of successive standards which were published by the American National Standards Institute (ANSI) for the C programming language.

Is ANSI C still used?

Technically, ANSI C is an outdated dialect (almost 30 years old!), but since it's more or less a subset of everything that followed, it's still a good place to start when learning C.

What is ANSI C style?

C89. The ANSI standard was completed in 1989 and ratified as ANSI X3. 159-1989 "Programming Language C." This version of the language is often referred to as "ANSI C". Later on sometimes the label "C89" is used to distinguish it from C90 but using the same labeling method.


Video Answer


1 Answers

"System environments" means things like Linux, Windows x86, Windows x64, etc. Notice how they use the term "architecture" interchangeably at the end of the paragraph.


A native C++ program is one where you take standard (ANSI/ISO) C++ and you compile it into a .exe. Usually you will be compiling this for a specific environment, e.g. Windows x86, in which case it could not run under Linux and would run under the WoW64 emulation layer on Windows x64. Notably, this code runs directly on the machine.

C++/CLI is a different programming language than standard C++. It, just like C# or VB.NET, runs on top of Microsoft's Common Language Interface. This means it has access to all those nice things in the paragraph you quoted, like the base class library and compilation to IL which allows it to be run on different architectures. But, just like C# and VB.NET, it does not run natively on the machine. It requires the installation of the .NET Framework; part of the .NET Framework's job is translating C++/CLI programs into native programs, which means they have much less direct access to the machine.

like image 174
Domenic Avatar answered Nov 26 '22 13:11

Domenic