What's new in C ++/CLI Language

Source: Internet
Author: User

As a new generation of C ++ language extensions for both local and hosted environments, C ++/CLI is positioned basically the same as the original managed extensions for C ++. In the CLR 2.0 Environment, it mainly carries the following five missions:

A.Source code integration (Local/hosted/hybrid)CodeCompile)
B.Object Model Integration (local type/pointer, CLR type/pointer, etc)
C.Component Model Integration (metadata support, attribute-Event Semantics, P/invoke/COM InterOP/C ++ InterOP integration, etc)
D.Generic and template integration (traditional templates, hosted templates, generics, and generic collection classes)
E.Large-scale framework integration (stl.net)

Currently, in addition to the ECMA standard text, there is no introductory monograph on C ++/CLI. Therefore, I have summarized and classified the new features based on my understanding. The details can be illustrated in msdn. Under the premise of understanding the target positioning, from the perspective of language characteristics, C ++/CLI's expansion of Iso c ++ mainly includes the following three aspects, the underline section is the DD that is currently discussed on the Internet:

1. object-model related
1.1 memory managements
· managed handle & Tracking reference
· reference type/value type / interface
· boxing/unboxing/stack sementics
· interior_ptr /pin_ptr
1.2 resource managements
· idispose pattern
· destructor/finalizer
· static constructor
1.3 managed array
· multi-dimenstmarray
· jarged array
1.4 new modifiers
· class-modifiers: abstract/sealed
· member function-modifiers: Virtual/New/override

2. component-model related
2.1 delegate & event
· bound Delegate/unbound DeleGate
· event pattern/composing delegates
· accessor of event: add/Remove/raise
2.2 managed property
· accessors: getter/setter
· indexed property
· multi-dimen1_property
2.3 predictional processing
· managed exception
· wraps of sehexception

3. templates & generics related
3.1 generics
· generic functions/classes/interfaces/delegates
· Explicit Constraints of type parameters based on base -Class & Interface
· classes of generic collections (what, why, how)
3.2 managed template
· Differences Between templates and generics
· combining templates and generics
3.3 'for each... in 'Statement

finally, I spoke a few nonsense words in the blog style... the general sense is that C ++/CLI semantics is clearer, more standardized, and more concise than MCPP, but it is not as exaggerated as most people emphasize. For example, I don't think _ box is superfluous, the newly introduced implicit boxing and stack object semantics encourage Program personnel to forget the packaging performance loss, impede optimization and create confusion... maybe I never really think MCPP is in trouble... although C ++/CLI has become a standard language in reality, despite its constant pursuit of completeness and perfection in grammar, there are still many inconveniences, perhaps this should be attributed to: "Microsoft products, which are not easy to use, are not clear to Microsoft ".
in any case, since the development of. net, regardless of the language, the language itself is no longer important (apl.net/ocaml.net/oberon.net/haskell.net,who care ?), It is important for us to support and understand the CLR and component environment, the CLR ideas and design concepts revealed by C ++/CLI on the hosted/unmanaged boundary are more critical than its own syntax features.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.