Development tools Visual C ++ vs. Delphi (1)

zhaozj2021-02-08  477

Zi Yunying, Zeng

introduction

"Comparison of Visual C and Delphi" recently discussed on the CBS forum very hot, this article will be in terms of a programmer, function, performance, ease of use, stability, development history and prospects, etc. Representative by Visual C 6 and Delphi 5, as far as possible to introduce the advantages and disadvantages of the two main development tools of Visual C and Delphi, which will involve language, application framework, control, compilation, and connection, integrated interface, debugging, COM, database development, etc. This article will also make some suggestions on how to choose these two development tools. It is worth mentioning that because C Builder is the same as Inprise products, they are different in addition to the language, and the remaining characteristics are almost the same. Therefore, this article also has a reference value for C Builder programmers and learners.

Language: There is reasonable first to declare it often confused: VC and Delphi itself are not a language, but the development platform. The languages ​​used are slightly extended C / C and Object Pascal. I often see someone asking if I should learn C / C or VC, this problem is very good: If you learn VC, you must learn C / C , or you learn VC, you will learn C / C . For the words, we will compare the advantages and disadvantages of C and Object Pascal. Some people think that Object Pascal is "Toy Language", C is "professional language", which is wrong. From the language itself, Object Pascal is the same heavyweight with C . They are all fully supported object-oriented languages, which are rooted in the "long history" oriented language. C is developed by C, Object Pascal evolved by Pascal. They all have strong flexibility, they have their own specialty and shortcomings. For example, Object Pascal does not support multiple inheritance, template, operator overload, inline function definition, pretreatment, macro, global static variable, nested class definition, and so on, these are C support. But the same, C does not support Object Pascal's fiction function, process nested, built-in set type, built-in string type, "finally" construction, etc., in RTTI Object Pascal is better than C . But this is not important because you can achieve the same purpose by other ways, such as C can support collection, strings, Object Pascal can be inherited by "interfab", and so on. The key is that both can complete the task of your hand very well, this is enough. However, only the language itself is not enough, but also to see their acceptance and population, learning curve, development prospects, portability, etc., and, it is important but often ignored: and development environment (referring to VC Delphi) and its application framework "Mollic" degree. VC and Delphi as a development platform, it is important to provide an "unpacking" application framework: VC's MFC and Delphi VCL. The MFC is written with C , and the VCL is written with Object Pascal. Of course, we all know that the range of use of C is much wide than Object Pascal, and the transplantability is much better. This is the advantage, but it is interesting to be, because of this, Microsoft must consider the maximum change to the language itself, while the kung fu is in the source code level, so that you can support ANSI and other standards, resulting MFC packages are complex and not intuitive. (Especially the package of the news, the following will mention it.) Too many macro definitions and implications are blurred and automatically generated, and the notes that must not be changed make MFC and even VCs to make a lot of new hands, do not dare to "underwater" in depth. Object Pascal is almost inprise "dedicated", there is no need to consider the "standard" problem, so the inprise writes the VCL to put all the energy in structure and performance, and the resulting language and the framework are very good. The VCL framework has a clear structure, and the readability of the VCL code is very good. Many people say that Delphi is easier to get started and this is the reason. Nothing is free in this world. Do you want industry standards? Do you want portability? (With regard to portability and compatibility, the following will be detailed in detail.) So, please face the MFC's "Tianshu" class code.

Compilation and connection: The NEED for Speed ​​is another different language brought, the compilation and connection speed is different, and the speed is different. Delphi's compilation and connection speed, no exaggeration, several tens of times faster than VC. Even if the VC's INCREMENTAL LINK option is opened, Delphi's compilation and connection speed is still better than VC. It is not said that Microsoft's compiler is not good, this is determined by the complexity of C . Template processing, pretreatment and macro deployment is very time. The forego is not mentioned to Object Pascal has no template, pre-processing and macro? This is a shortcoming, but the benefit of bringing is that the compilation speed is extremely fast. As for the compiled binary code, the Delphi and VC execution speed do not have much difference in the case of opening the same optimization option. In order to overcome the speed of compilation, the C compiler generally requires enhanced connector and pre-processing mechanism. However, the pretreatment mechanism still has several issues: 1) The breakpoint line of the program debug may be different from the code line. 2) Do not take the latest code information into it. 3) It is easy to generate an error logic. 4) It is easy to generate an error similar to "UNEXPECTED End of File" because of the read error file header.

The two compilers have a common point to identify the useless "dead" code, such as a function that is useless, and so on. The compiled program will not contain these extra information. Delphi is more excellent in this regard. It allows you to visualize the line of code in the editor, "live", the line of code is "dead". This way you can organize the most streamlined code. Delphi will display a small blue point on the left after compiling means that this line code is "live". Visual C can't do this.

Delphi compiled executable at least 200K (if you do not use VCL, just use WinAPI, the size of the file will be greatly reduced). However, Visual C programming uses MFC compiled executable only dozens K, mainly because Microsoft has included the system running library in the Windows system (Borland once again negotiated this interface, but Microsoft utilized the advantages of the operating system Willing to disclose). The same truth, the database program developed using BDE must be included with an additional system file of 3-5M, which is also very uncoordinated.

Very interesting is that Delphi can use the OBJ file created by C Builder, but use great limitations.

By the way, take the VC's "Edit and Continue" function. In debugging, this function can be greatly saved, but still can't compile with Delphi's flash.

Finally, the error information when Visual C is compiled and connected is more detailed and more than Delphi. Especially use ATL development more.

转载请注明原文地址:https://www.9cbs.com/read-438.html

New Post(0)