STILL IN Love With C Chinese version (1)
[Posted: 2002-4-18 15:44:17]
Still in Love with C Chinese version of the Modern Language Features Enhance the Visual C .NET Compiler Author: Stanley B. Lippman Translator: Glory Abstract: Using C programmers have been for many years now in the midst of confusion: how to cater to their language C # And .NET coming? This article is taught about how C applies to the road sign of the .NET world. In .NET, C code can be used in two ways: managed and unmnaged. The uncontrolled code does not have CLR, while the controlled code is committed to using C controlled extensions. This article explains these two ways. Our people in our C communities feel that they are like a middle-aged child who has just come to a new baby. - Everyone is fanatically surrounded by this new little guy, (here,) even Someone gently took our head, we were lucky. It is difficult for us to have a feeling of being ignored and a little bit of harm. This is actually worse in technology, because the foundation is constantly drifting, and it is incorporated to survive. Of course, today's Microsoft .NET framework is new technology that is selling, how rich a big meal! Everyone is in the language called C #. If you are a C programmer, you can't doubt if you should learn C #, after all, in .NET discussion, if you take it with C # contrast, it is rare to mention C . Is the C programmer out of time? Absolutely not! In this article, I will introduce the new things in the current version of Visual Studio .Net, and give you some concept of Microsoft about C future plan. First, I will introduce two aspects of C in Visual Studio.NET: standard C and C are regulated. Maintaining compatibility is the main motivation behind standard C recently progress, that is, support support for ISO language characteristics. I will also discuss C controlled extensions, which makes C into a .NET language. Standard C standard compatibility in Visual Studio .NET has been made in the following field: l The virtual function definition now supports the cracked return type, which is a good news for those who write class hierarchies. l Static integer constant members can now be explicitly initialized. l Join the support of the MAIN to return 0. Below, I will briefly discuss each area. Join the Candarity Return Type is the first revision of the C language (approval by the Standard Commission). This is a wonderful-derived virtual function now returns an example of a derived class, and the virtual function in the base class it returns an instance of a base class. This is an important design idiom support for class hierarchies, and it is a popular "additive" in Visual Studio .NET. There is an example of a typical usage. Test abstract base class Query: class query {public: Virtual Query * Clone () = 0; // ...}; In the derived Class NOTQUERY instance, Clone returns a copy of a NotQuery object.
For example: class notquery // [Translation: This type of declaration is a bit problem] {public: virtual ???? Clone () {return new notquery (} // ... public: query * operand;}; No support for the Coordination Return, the return type of the NotQuery instance Clone must be query *: // no covariation return type support ... Virtual Query * Clone () {Return New NotQuery (this);} This will work Very good If you assign the return value of Clone to a query * pointer, just like this: NOTQUERY :: NOTQUERY (const notquery & rhs) {operand = rhs.Operand-> Clone ();} But this is not - when you want to show When it assigns it to a Notquery *, as follows: NOTQUERY NQ (New NameQuery); // [Translation: Less ")"]. // OOPS: illegal assignment ... NOTQUERY * PNQ0 = nq-> clone (); // ok: Need to convert ... NotQuery * pnq1 = static_cast
There are three aspects for the framework: core language support, such as collection classes and system I / O; basic programming classes, such as support for threads, network sockets, and regular expressions; application domain support, such as XML, ASP.NET , Web Services, Windows Forms, and ADO.NET, etc. l You can write directly in the .NET environment, just like in C # and Visual Basic. However, this version of C has not yet provided support for RAD designers, such as Windows Forms and Web Forms. First, I will discuss packaging an unregulated implementation. In my "C Primer", I created a relatively large text query application, which focuses on the STL container class to parse text files and establish internal representation. Table 1 shows the included file, Table 2 shows the data representation. Table 1 Text Query Application Contains File #include