One-time compilation and secondary Compilation

Source: Internet
Author: User

C ++ and. netProgramTwo different compilation methods are used. Generally, a program written in C ++ is compiled into binary at a time.CodeAnd can be directly executed on the corresponding operating system platform. However. net program uses the method of two compilations, using C #, VB. programs Written in languages such as net are compiled into il code, and compiled into local binary code by running the clr jit.
I personally think that the differences between MFC and winform are basically caused by differences in the compilation mode. Therefore, before carefully exploring MFC and winform, it is necessary to take a closer look at the changes brought about by different compilation methods.
Consider a piece of code. It needs to generate different code in different compiling environments, or replace similar code with some replacement methods to reduce the amount of code writing. Use pre-compilation and Macros in C ++ to solve these problems. In the MFC framework, a large number of macros are used to design core functions. However, macros are just a clever way to reduce the amount of input code. They are essentially no different from writing some code (maybe not strict enough ), it cannot dynamically support code insertion and modification when the program is running, because it has been compiled. The secondary compilation is different. You can regard the first compilation as the pre-compilation period of a General Compilation Program, but this pre-compilation is more powerful, it can compile and generate richer metadata. In addition, as long as the code is inserted dynamically before JIT execution, reflection and other means can be used to change the behavior of compiled programs to some extent, its Dynamic performance has basically changed.
Therefore, in MFC and winform, we can see that the two are very different in dynamic performance, security, and efficiency. To sum up, it can all be attributed to the different compilation modes. You can see these differences in future logs.

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.