[Collection] C ++ parent B. Stroustrup Recent speech

xiaoxiao2021-03-06  40

[Translator Press] Dr. Bjarne Stroustrup, born in Denmark in 1950, graduated from Denmark University and the UK Jianji University, AT & T Laboratory, AT & T Bell Lab and ACM members. In 1979, b. S began to develop a language, called "c with class", and later evolved as C . In 1998, the ANSI / ISO C standard was established, and the same year, B. S launched its classics THE C Programming Language. C standardization sign B. Dr. S. The great idea of ​​20 years of blood is finally realized. However, the development of computing technology has a thousand miles away, and in a few years ago, people also guess C eventually will finally be a world, but with the explosive growth of the Internet, the new modern language similar to Java C # is aggressive, and various Script language is even more like rain. Spring bamboo shoots have emerged. In this case, people can not help but feel awkward. Is C have been out of time? What is the prospect? What is the meaning of standard C ? How should I learn? Let's take a look at B. S thinking about these problems. The following text is selected from the translator from Stroustrup1998, and it is repeated due to different sources, and it is also translated in order to maintain completeness.

The following content is selected from the FAQ published on B. S in its home page.

1. Please talk about C books.

No, it is impossible to have a book is best for everyone. But for those real programmers, if he likes to learn some new concepts and technology from the middle of the "classic style", I recommend my THE C Programming Language, the third edition and special edition of 1998. The book is pure and pure C , which is completely independent of the platform and library (of course, the standard library can be said). The written written to those who have a certain experience, helping them to master C , but not suitable for beginners who have no experience, and is not suitable for those temporary programmers to taste C snacks. So the focus of this book is concept and technology, and there is a lot of effort in integrity and accuracy. If you want to know why C will become today's appearance, my other book The Design and Evolution of C can give you a satisfactory answer. Understanding the principles and restrictions can help you write better procedures

Www.accu.org is one of the best book review websites, many experienced programmers speak here, let's take a look.

2. How long does it take to learn C ?

It depends on what you mean by "learning". If you are a PASCAL programmer, you should quickly make your C level to the extent to which Pascal; and if you are a C programmer, you can learn more excellent C style using C within one day. Program. On the other hand, if you want to completely master the main mechanism of C , such as data abstraction, object-oriented programming, general programming, object-oriented design, etc. Be odd. So is this that this is the time you need to learn C ? Maybe there may be another reappearance, I want to be a better designer and programmer at least so long. If you learn a new language, you can't make our work and ideas.

Change, why did you come? Learning a new different language and programming style is simple compared to a pianist or proficiency in a foreign language. 3. Learn about C is the prerequisite for learning C ?

No C has a similar subset of C, which is better than the C language itself, and the type of error will be less, and it is not like C, and there is a better support library. So you should learn C from this subset.

4. If you want to be a real OO programmer, is I got to learn SMALLTALK?

no. If you want to learn smaltaok, despite going to learn. This language is very interesting, and learning new things is always a good idea. But smalltalk is not C , and does not have any good results in the SmallTalk's programming style in C . If you want to be an excellent C programmer, it is not bored in a few months, please concentrate on learning from C and his thoughts behind it.

5. How do I start learning C ?

This depends on your foundation and learning motivation. If you are an initiator, I think you'd better find an experienced programmer to help you, or if you are unavoidable in learning and practice, it will greatly blow your enthusiasm. In addition, even if your compiler is equipped with sufficient documentation, a C book is always essential. After all, the documentation is not a good textbook for learning programming.

When choosing books, be sure to pay attention to the standard C from the beginning and use the standard library mechanism. For example, reading a string from the input should be like this:

String S; // Standard C Style

CIN >> S;

Not like this:

Char S [MAX]; / * Standard C Style * /

Scanf ("% s", s);

Let's take a look at the book recommended by the solid C programmers. Remember, no book is best for everyone. In addition, to write authentic C programs, avoid writing traditional style programs with C syntax, new bottles have not much significant meaning. (Unfortunately, in the Chinese C textbooks on the market, it can be said that it can be said that there is no one, you have to find some English information on the Internet. - Translator)

6. How to improve my C program?

Hard to say. It depends on how you use this language. Most people underestimate the value of abstract classes and templates, but in turn use the modeling mechanism (CAST) and macro. You can take a look at my articles and books. The role of abstraction and template is of course providing a convenient means to construct a single level or reuse function, but more importantly, they provide a simple logic service representation mechanism as an interface.

7. Is the language choice is important?

Yes, but don't count on the miracle. Many people seem to believe that a language can solve almost all problems encountered in system development, they constantly look for perfect programming languages, then failing again and again, and frustrating. Other people will desess the programming language to be insignificant details, put the big silver on the development process and design method, they will always use Cobol C and some proprietary languages. An excellent language, such as C , can help designers and programmers do a lot, and their capabilities and defects can be clearly understood and treated.

8. Is the ANSI / ISO Standard Board not ruined C ?

Of course not their (we) work is excellent. You can find some 歪 理 in some details, but I personally make this language and the new standard library. ISO C is more good and more stronger than the previous version of C . At the beginning of the start of the standardization process, you can write more elegant and easier maintenance C programs today. The new standard library is also a real gift. Since the standard library provides Strings, Lists, Vectors, Maps, and the basic algorithms acting on them, huge changes have occurred in the ways of C . 9. Do you want to delete some C features now?

No, true. People who ask these questions probably hope that I am answering one of the following characteristics: Multi-inheritance template and RTTI. But without them, C is incomplete. In the past N years, I have repeatedly considering their design and improved their details with the Standards Commission, but there is no one that can be removed and does not cause a big earthquake.

From the perspective of language design, I don't like some is the subset with C, but I can't remove it, because the programs who work in the real world are too big. C and C are compatible, this is a key design decision, it is definitely not a soldier. The implementation and maintenance of compatibility is very difficult, but it does make programmers have benefited more.

But now, C has a new feature, and programmers can free from a C style that is more troublesome. For example, using the container class in the standard library, like Vector, List, Map, String, etc., you can avoid the tips for tips with the underlying pointer *

10. If you don't have to be compatible with C, is the language you create will be Java?

No, it is far away. If people don't take C and Java as comparison, I suggest them to read the Design and Evolution of C , see why C looks today, use the principle of designing C to test these two languages. These principles are obviously different from the idea of ​​the Sun's Java Development Team. In addition to the similarities of surface syntax, C and Java are distinct language. In many ways, Java is more like SmallTalk (Translator Press: I use Sun's training materials when I learn Java, which clearly wrote: Java uses the syntax similar to C , Semantic with SmallTalk in design. So similar to SmallTalk. So It can be said that Java and C are generic gods, and smaltalk is the heart of the heart. The Java language is relatively simple, this part is an illusion, part is because this language is still incomplete. Over time, Java will grow significantly in volume and complexity. It will increase two to three times in size, and there will be some implementation related extensions or libraries. This is a road to the development of each successful business language. Casually analyze a language you think in a great range, I know that it is definitely no exception, and it is actually very reasonable.

The upper side is written before Java 1.1. I am sure that Java needs a mechanism of templates and needs to enhance support for inherent types. Simply put, these work should be done for basic integrity. In addition, you need to do a lot of small changes, most of them are expanded. In the autumn of 1998, I got a proposal from James Gosling (the founder of Java language - translator), saying that in Java added an inherent type * log overload and mathematical calculation support. Another paper is a world-class master in the field of mathematical analysis, and HOW Java's Floating-Point Hurts Everyone Everywhere, W. Kahan, University of Berkeley, and how Java's floating point operations are harmful. - Translator) reveals some secrets of Java. I found that in TV and publications, Java's advocity is inaccurate, and the momentum is annoying. The big code is not Java code is garbage, this is an insult to programmers; it is recommended to rewrite all reserved code with Java, which is a heart, neither realistic is not responsible. Sun and his followers seem to feel that in order to deal with Microsoft's "Imperial Times", they must be so self-sufficient. But insults and fraud will only force programmers who like to use different programming languages ​​to the Microsoft Camp.

Java is not a platform, it is itself a platform. Like Windows, it is also a proprietary business platform. That is, you can write code for Windows / Intel, or write code for Java / JVM. In either case, you are writing code for a platform belonging to a company, which is related to it. The company's commercial interests are pulled together. Of course, you can use any language, combined with the system's mechanism to write programs for JVM execution, but what the JVM and things are strongly biased towards Java languages. It is also like a VM / OS neutral in a universal fair language.

In private, I will insist on using the portable C for most work, and use different languages ​​to work.

("Java IS NOTFORM-INDEPENDENT, IT IS THE Platform", B. S is a great impact on C users, and the translator sees in several newsgroups abroad. Some C experts even put This sentence as its own signature file to indicate the attitude towards Java and the determination to defend C . In fact, many programmers are not just as a tool, but also a kind of belief. - Translator )

11. How do you view C # language?

I have nothing to say about the C # language itself. I want me to believe that this world needs another proprietary language is not an easy task, and this language is still specifically for a specific * as a system, which makes me unacceptable. Directly, I am not an obsessed with a proprietary language, but an open official standard supporter.

12. When doing a big project, do you really recommend ADA instead of C ?

of course not. I don't know who this is a rumor that is passed, it is definitely an ADA believers, or it is too fattle, or it is not good.

13. Would you like to compare C with other languages?

Sorry, I don't want it. You can find reasons in the Design and Evolution Of C introductory text.

Many book reviewers invite me to compare C than other languages, I have decided not to do this. Here I would like to reiterate a view that I have always emphasized for a long time: There is no significance of the comparison between the language, and it is more unfair. The reasonable comparison between mainstream languages ​​takes a lot of energy, and most people will not be willing to pay such a big price. In addition, there is a need in a wide range of applications, maintaining a position that is unbiased to objectively independent, and is a fair selfless belief. I don't have time, and as a c creator, I will never get complete trust in justice selflessness. People try to bring a long and short language, some of which I have already noticed again and again, and I feel frank. The authors do their best to express their fairness, but they are ultimately unpaired to a particular application, or a specific programmer culture. Worse, when a language is obviously more famous than another language, some unrecognizable stolen beam is started: the defects in the more famous language are intentionally diluted, and they are incorporated by corners; The defect is described as a fatal and hard injury in the non-listed language. Similarly, the technical information about the relatively famous language is often updated, and the technical information of less famous languages ​​is often a few years ago. How does this comparison? So I have strictly limited the language of C language to be in general particularly specific areas.

In other words, I think C is the best choice when most people have developed most of the applications.

14. Others often take their language with C , which makes you feel uncomfortable?

I really feel uncomfortable when these are incomplete or for commercial purposes. Most of the most widely comparative reviews are published by some languages, which is the purpose of the Z language, with the aim of prove that Z is better than other languages. Since C is used extensively, C usually has a name on the blacklist. Typically, such an article is caught in the product provided by the Z language supplier, it has become a means of its market competition. Shocking is that there are quite a lot of such comments to reference those employees working in the development z language, and these can't afford the test articles are nothing more than wanting to prove Z is the best. Especially in these comparisons, there are some factors that have some zero dispersions, (so more deceptive-translators), after all, there is no language is best in any case. C is of course imperfect, but please note that the fact that specially selected, although it seems correct, it is sometimes completely misleading.

When you see the article in language comparison, please pay attention to who is written. Is his expression not based on the fact, especially the criterion of the criterion, especially the criterion, is not included in each language quoted. It is fair and reasonable. This is not easy to do.

15. When do you do a small item, is C ?

I think it is not. In addition to issues caused by lack of good C compilers, I have never seen which project C will be more appropriate than using C . (But now the problem caused by the C compiler is not negligible. When you see the same function, the C program can perform code volume ratio C, it will feel much more, it will feel much slower. - Translator )

The following content comes from Visual C Developer's Journal

Elden Nelson's Interview with B. S in March 2000

16. If you have the opportunity to design C language from the head, what different things do you do?

Of course, you will never re-design a language, that is meaningless, and any language is the product of its era. If I let me design a language today, I will still consider the complexity and people's preferences. You must know that people's habits have a huge impact on their preferences. Now, I will find a simple grammar, I will limit the conflict of type system to few cases in a few cases, and you can easily discover these issues. This will make it easy for unsafe *. (B. S is: For bad code, even if you can't completely ban, you should also make it bigger than the world, not hidden in the dark corner of the dark arrow. C actually provides such a mechanism For example, if you use ReinterPret_cast , it is obviously very bad expression to make a style, others will easily find the problem. Only C still allows you to use traditional C style modeling mechanisms, There are many people who have always used this vintage style, so there are more troubles. B. S means that if it is possible to ban the old style, how good is the language designer, I am afraid that there is no This opportunity, but as a language user, there is still a big hope to improve your code. Where is it, it should be what we are thinking. - Translator)

I will also make the volume of the core language as little as possible, including the key abstraction characteristics of classes and templates, and put many other language features in the library. Of course, I will also guarantee that the core language is sufficient, so that the libraries are also sufficient to use this core language. I don't want the standard library to create a mystery mechanism that does not belong to the language itself. In addition, I will make the definition of this core language more accurate. (There are many new languages ​​to use "mystery mechanisms that do not belong to the language itself", such as VB and Java. From theory, this is a nearly rogue, so B. S is not good. But From practical departure, there is no hurt. - Translator)

Most importantly, I will maintain a long brewing period as much as possible before this language, so I can improve the feedback from others. This may be the most difficult, because once there is something obviously good and promising, everyone will swarming to use it, and there will be any incompatible corrections. It will be very difficult.

I believe that these ideas are very similar to what I originally designed C , which is also these ideas to guide C C in a twenty year. Of course, I think there is still nothing to make me feel like "perfect language."

17. What are you expected to do in C , will you delete something?

Unfortunately, although some things should be thrown away, I am afraid it is hard to really delete anything. The first thing that should be abandon is the shape of the C style and the type truncation conversion. Even if it is not prohibited, the authors of the compiler should also give this behavior to a strong warning. I hope to completely replace arrays with things like Vector, but this is obviously impossible. However, if the programmer can take the initiative to use the Vector to replace an array, it will benefit from the array. The key is that you don't have to use the most complicated difficult skills in C , now there is a much better alternative.

As for the main features, I didn't want to remove anything. In particular, those main features that distinguish C and C are probably not wavy. People who usually ask these questions are hoping that I will pick out the mechanism such as multi-inheritance anomalous template to accept criticism. So here I want to make a clear understanding, I think the multi-inheritance mechanism is required for the inheritance of static type language, the abnormal mechanism is the correct way to deal with the error in the large system, the template mechanism is the exquisite safety. And efficient professionals designed for a panacea. We can pick up challenge in small details, but in terms of big aspects, these basic concepts must stick. Now we are still learning standard C , and we are also developing updated more interesting programming techniques based on the characteristics provided by the standard. In particular, people have just started using STL and abnormal mechanisms, and there are still many high-efficiency and powerful techniques, so they don't have to hurry to increase what new mechanisms.

I think the current focus is to provide a lot of new more exquisitely more useful libraries than before, which has great potential. For example, if there is a library that can be widely used, it will be a big gospel - C style thread library (such as pthread - translators) is not good enough. We can also match a variety of other systems, such as SQL, and different component models. People in the field of numerical calculations seem to have been in front, similar to the development of efficient and exquisite libraries like Blitz Pooma MTL has achieved extraordinary achievements. (Translator has visited BLITZ and Pooma homepage, the former is a high-performance math library, which is said to be up and down with Fortran 77, while supporting a large number of C features. I think anything is in the field for numerical calculations. What you know knows how great it is. Pooma is a project specializing in studying C parallel mathematics algorithms. It is even more unlimited. The translator is very agree with this concept of B. S. - Translator)

With enough experience, we can better decide what to do with the standard.

18. Obviously, the world has changed in the past few years, and is moving towards a time that is mainly distributed as a central distributed in Web. So do you think C still maintain its position? Programmers can not put several special languages ​​(such as Perl

JavaScript) Comprehensive use to completely replace a generic language? (C is this universal language - translator) What should I do with the new computing mode, C and its standard libraries?

It has never been suitable for all work, I am afraid that there will be no later. The actual system is usually constructed in a variety of languages ​​and tools. C just wants to be one of several languages ​​and tools, and they can be complementary to C when some dedicated languages ​​are particularly highlighted in their field. That is, I think that if most of the current dedicated languages ​​can work together with the C library in specific areas, they will be better. The scripting language typically leads to a difficult-to-maintain code, and there is no other place to give the program's structure scalability and maintenance optimization.

I don't dare to affirm whether the future code is really a web-centered. Even if the system directly processed the Web is mainly composed of a program module that handles local resources, such as IP connections.

Geographic distribution and server software's high dependence on concurrent mechanisms are indeed a challenge for the builders of the system. Some libraries for the above problems have appeared, maybe we will see that they are finally standardized. Of course, some original * work and guarantee rules should be added to the core language to provide better support for these libraries.

Overall, for web and networks, we need a real system / network-level security model. Expect

The scripting language such as JavaScript implements this model is tantamount to Dream.

Note, I didn't say C to provide this problem solution. C center of gravity is an efficient access system resource, not anti-fraud.

19. How do you see C future? Will it decline in the next 10 years? Or do you basically keep the present form? Or in the form of development varies?

C has the best future. Use it you can write a great code. In addition to deliberate malicious fraud, C will still be the best language to develop high performance high complexity systems. As far as I know, there is no language that can be unified in universal efficiency and exquisite three aspects.

I didn't see the sign of C fading. It will grow continuously in the future I can foresee. Of course, we will see some changes in the next ten years, but it will not be as significant as you think. Like each language, C will also grow. "Language experts" require improvement to improve, but the basic requests of system developers are stable.

C will improve, but these improvements will be mainly to reflect the lessons learned from practice, but will not be hipster in order to chase the wind. In order to more efficiently use new programming technologies, such as general programming techniques, some small features may be added. There will be a lot of libraries, and I expect a new and more excellent library support mechanism. I hope that new extensions are mainly concentrated in the general characteristics of abstract, rather than providing specific mechanisms for certain special tasks.

For example, the concept of "attribute" is useful, but I don't think there is a place in a general programming language. This concept can be easily supported with a set of standard C . If we feel that the support of the concept of "attribute" is not satisfactory, it will not immediately ran to increase the attribute mechanism in the language, but carefully consider how to improve the class and templates to help the library designer Close to the concept of "attribute". Perhaps a satisfactory answer to this issue by improving the function object.

In order to keep C to keep flexible and variable in the next decade, it is a basic point to do not let standard C have a hipster or commercial. A large part of the increased characteristics can be achieved by using existing standard C development new libraries. Also, many features that people are eager have been included in standard C and are supported by the latest compiler.

For many programmers, the best way to improve the quality of code is not what language extensions, but slowly taste the latest C technical books (but we have no such opportunities so far - translator) .

20. How do you view the prosperity of scripting languages? Especially Python, it seems to provide a simple way to learn OO technology.

Some languages ​​are very good. For example, Python, I like it very much. But I think you are not exactly the same as the OO technology you have learned from different languages. Of course, every professional programmer needs a few languages ​​and understands the differences between programming and design technology in various languages.

In my opinion, the system built with scripting languages ​​is different from the system built with C . The technical difference between the two types of languages ​​is obvious. There is no common part in OO technology, it is critical to efficient construction of various systems.

21. Is there any new feature to add some new features to standard C to support distributed calculations?

No, I don't think there is this necessary. Almost solve the problem with a better library. Most, in order to support such libraries, we may add some low-level original * work and rules.

22. Is there a possibility of a portable binary interface in the future C ?

If you say "portable" refers to hardware and block * as a system, I want to answer it. We can of course design an interpreter or virtual machine (like Java practice - translator), but in this way, the ability of C will be weakened because it cannot access system resources in the best way. I really hope that something that can be seen in the future is Platform Abis (ABI, Application Binary Interface). For example, some people are working to define C ABI for Intel's new IA64 system, I think these efforts will get huge support from users. It is a very meaningful thing that can be compiled with code generated by different compilers. 23. In a lot of popular fields, C is gradually losing light, because it requires people to spend a lot of effort to deal with some basic work, such as managing memory (because there is no garbage collection mechanism), the dependence between management modules ( Because there is no package mechanism), the version of the component is managed. C lacks some modern languages ​​have considered the characteristics of standards. For example, the coolest Java language in rumors pay special attention to these issues. So do you solve these issues will cause the development of C from its fundamental purpose? What should C develop to ensure that we have a reasonable return in this language, rather than being forced to re-use another language?

I haven't noticed that C is less than before. On the contrary, I see the indicator indicates that the use of C is still steadily increased. However, this base has a large stable growth and the continuous improvement of standard transplantability and library surface do not have any spoofing news effect. I think what you said is just a phenomenon in market sales and news.

If you need a garbage collection mechanism, you can insert a garbage collector in the C application. Many free and commercial garbage collectors have proven to be excellent in important practices.

If you don't want to use garbage collection mechanisms, it doesn't matter. You can use standard containers, which greatly reduces the need for explicit allocation and recycling memory. This way, using modern libraries and modern programming styles, you can avoid most of the memory management issues.

The same technique can also be used to avoid management issues of general resources. Not only the memory will leak, thread handle files mutex network connection, etc. are important resources, in order to establish a reliable system, these resources must be properly managed. If you feel that there is a garbage collection mechanism to solve all resource management issues, then you'd better wake up from the dream.

C provides a number of mechanisms to manage general resources. Key means - "Resource Acquisition IS Initialization" (this is a famous RAII usual method, often encountered when reading the original text, its meaning is to make all resource allocation applications in the object initialization process, but release resource release Action is placed in the object destruction process - the translator) can use the function object to manage the survival problem. The local constructor and abnormal mechanism of the object provide support for this technology.

Some languages ​​are always describe C with a back method of ironic comics, but C is actually much better. Especially, I think many other features have been flooded. In C , it usually is easy to simulate it. Conversely, new languages ​​are always increasing in the process of promotion, which is why it is widely used from a language to be widely used, and its volume usually increases two or three times.

At present, the most personal and organized, the best investment of C is to better understand standard C and modern C design programming technology. Most people use C ways to actually stay in the mid-1980s, even more old than that. As for module-dependent issues, my point of view is that there should be a clear boundary between the work of programming language and the system, depending on the relationship should be separated from the programming language as much as possible, but by the system.

I don't think that the problem of forming a version should be solved by a programming language. This is a problem in a system category. In language, you should resolve it by providing the corresponding library. C has such a mechanism.

Solving such problems will not deviate C from the track. But adding a lot of special features to C will cause C deviate from the track, and it will be a reverse in terms of maintaining portability and platform independence.

24. Standard C has been launched for a period of time, Java also stepped forward and achieved significant progress, how do you compare Java and C now? What do you think of Java wants to become like a language like C ? Do you have learned from Java? Is there any Java feature that you think can be absorbed by C ?

I don't compare the language. It is very difficult to do this job and have few professional levels.

I think C progress will be based on the problems encountered in their users and their own logic. Of course, some ideas in other languages ​​will also be considered, but they cannot be simply passed down. You must examine those mechanisms in technology and ideological backgrounds, and find the best solutions to support these technologies in C .

Sometimes the best choice is to use several languages. After all, there is no language to put it four seas. C is now in the future, will continue to be one of the best languages ​​in a wide range of applications. However, we can't be pulled down, and you can't put all possible features to C to open to the public. I think Java and C will now be very different in the future, the syntax is similar, but the object model behind is significantly different.

For me, a very important difference is C has an ISO standard, while Java is a proprietary language.

25. In those years that Java have just appeared, there are many spoofing speeches that it will be the ultimate language and will replace C . Do you think Java has an impact on the followers of C in the past two or three years?

It is also visible everywhere about Java now. The development of Java in the past five years, the fanatical public seems to think that Java will end alteration of not only C , and there are all other programming languages. But on the other hand, the use of C is still continuing to grow. I don't think that Java's impact on C has made people turn to develop the Java tool library to develop the Java tool library for a resource that intends to create better C toolbits. Java doesn't have much new thing for those who learn programming, so there is no impact on the definition of C . In that field, Java has worked hard to catch up. For example, I think Sun will add a similar template to Java sooner or later.

People should recognize how different C and Java goals are. Taking C design concepts to measure Java, or measure C with Java design philosophy, it will not be good.

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

New Post(0)