Translation: Ye Feng
For the original page, see: http://www.c-view.org/journal/008/BS_FAQ.htm#idAbxknc
These are some problems that people often ask me. If you have a better problem, or if you want to make some comments, please write to me
This paper focuses on discussing some of my personal opinions and general issues related to philosophy. For C language features and use, please see C Style and Technique FAQ. For C terminology and concept, please see C Glossary. For some useful resources and information about C , please see C Page. For books I wrote (including comments and support information), please see Book List. For the papers I wrote, and ISBN of the various translations of my book, please see the publication list.
Here is some of the partial FAQ (Traditional Chinese) of Ye Bingzhe.
Q: "Bjarne Stroustrup" how to read? A: This may be a bit difficult for non-Scandinavians. As far as I know the best suggestion is: "I will read a few times in Norwegian, then plug a potato in the throat, then read :-)" There is a WAV file. If you can't listen to this sound file, there is some prompts here: My surname is all two syllables: bjar-ne Strou-strup. B and j in my name are not accent, and the NE is pronounced very weak, so the whole sounds like Be-Ar-Neh or BY-AR-NE. The first U pronouns in my last name should actually like V, so that the pronunciation of the first syllable ends in the deep throat: Strov-strup. The second U is pronunciation of OO in OOP, but it is shorter; pronunciation of the strov-stroop allows you to have a concept. Yes, this may be my most often asked questions :-) PS My name is Bjarne, not bjorn (this is not a name), bjørn (a associated but different name), nor Barney (one is not Related names). My surname is Stroustrup, not StrousTroup, StroustroP, Strustrup, Strustrop, StrusTroup, Straustrup, or StrausTroup (every wrong spelling can be found with Google). Q: Can I ask you questions? A: of course. I will reply as much as possible. However, please try again and again and again, I have already answered questions on the homepage. Moreover, please don't expect to get a quick answer. The email I received is too much. There are some links here:
Personal resume C information and link papers (partially downloadable) books (including book review, errata and some chapter download) interview
Q: Why don't you reply to my email? A: I will reply, but I have received too much. I estimate that I have returned more than 90% of the letter. But sometimes I will be overwhelmed by the letter. Some letters are lost, some want to wait until there is time to return, some will wait until I reply to a group of related letters (often comment on the potential error in my book). Unfortunately, the longer, the more connotation, the more connotation, often more than a simple letter than the simple answer. Also, if you write to me, please confirm that I can give you back. I hate that after I finish writing and sending a reply, I found that the reply address is invalid or cannot be accessed. Relatively speaking, the possibility of two ways to be ignored is relatively large: about the problem of homework and similar "How do I use a certain library?". I feel a little sorry for the next question, because the questioner often does not understand the DOS, Windows or any other C programming interface is not part of the C standard (and I can't keep up with so many C libraries). If you don't receive a reply, please consider your question is not the type above. Q: Why don't you do your website more trendy? A: I am a "content provider" instead of website designers. I can spend time to improve the content or appearance, but I can't get together. You think it is very cool and very fashionable, it is likely to be considered to be great taste by others. Moreover, the popular moment is changing. The HTML download and display of plain text are fast than anything else. After all, there are still many people who have endured low-speed connection. Q: What books from C begin to start? A: No book is best for anyone. There is no such book. People have a distinct study method, knowledge background, learning goals, and work that is willing to pay. For programmers, if you want to learn new concepts and technologies from classic textbooks, I recommend the C Programming Language (3rd Edition). This book tells the "pure C ": completely independent of any specific development environment and the language of the base library (except for standard libraries). If you feel inappropriate this book, there are many other excellent C books. In my description of "The C Programming" structure, content and positioning: This written written is considered to have a certain experience and want to master C programmers. It is not suitable for beginners who are learning the first programming language, nor is it suitable for temporary programmers who wish to have a thick understanding of C as soon as possible. Therefore, this book focuses on concepts and techniques, and has a lot of effort in integrity and accuracy. If you want to know why C will become now, see The Design and Evolution Of C (D & E). Understanding C design principles and limits can help you write better procedures. The Accu (The Association Of C User website is one of the best book review websites, many experienced programmers speak here (book providers tend to give overflowing words, and like "this book is great. I like it too much. I have finished reading three chapters. I really want to read it. "The comments like it" are useless. I just don't understand why some people will believe in the learning suggestions given by those who do not have C experience. The Accu website is rated based on the experience and books of the target readers and the overall quality of books. Q: How long does it take to learn C ? A: I do what you mean by this "learning".
If you are a PASCAL programmer, you can easily learn basic types, control structures, and library letters like your Pascal. Is this still a day or a week? This depends on your way you take. I have seen people with various learning speeds. If you are a C programmer, you can learn more efficient C-style programming with C within one day. On the other hand, if you want to completely master the main mechanism of C : data abstraction, object-oriented programming, generic programming, object-oriented design, etc., and you are not familiar with them, so spending less than two years. So is this time you need to learn C ? Perhaps, but if you want to be a more excellent designer and programmer at least so much time. If it is not to make our constructive system's work mode and thinking, why do you want to learn a new language? Compared with learning piano or proficient in a foreign language, learning a new, different programming languages and styles are simple. If you want to know more about C learning, please refer to D & E or an article published in Comp.lang.c before. Q: Learn about c is to learn C prerequisites? A: Not. C and C public subset is easier to learn: need to manually correct type error (C type system is more stringent, also more expressive), do not need to learn a variety of skills (you can use C simple Demonstrate more), there is a better library available. The best subset of the starting point for learning C is not the entire C language. There are some discussions on how to choose C entry learning materials (C structures, technology and libraries) in Learning Standard C As A New Language. There are some textbooks that systematically take this approach, such as the "Accelerated C " written by Koenig & Moo in Addison Wesley in the C in Depth Series. Q: Do you want to be a real-oriented programmer, I need to learn SMALLTALK before studying C ? A: No need. If you want to learn SmallTalk, then despite going to learn. SmallTalk is a very interesting language and system, and there is always a bad thing in new things. However, SmallTalk is not C , and the code written with C is always not too ideal. If you want to be an excellent C programmer, and there is no more time for a few months, then concentrate on learning C and what it contains. Q: How do I start learning C ? A: Nature, depending on your foundation and learning motivation. If you are a newcomer, I highly recommend you to find an experienced programmer to help you. Otherwise, you are unavoidable in the process of learning the misunderstanding of language concepts, and the various actual problems related to the compiler are greatly hit your enthusiasm. You need a good textbook, even if your compiler has rich online help. Because the language and library documents and examples are not a good teacher who teaches you concept. Usually these code will tell you why you want to write, and what benefits or bad things there is a technology. You need to put your attention in concepts and technologies, not the details of the language. When you choose, you choose a book from the beginning using the standard C and standard libraries. For example, from the input read a string should be like this: string s; // standard C stylecin >> s;
Instead of char s [MAX]; / * Standard C Style * / Scanf ("% s", s);
Pick the books recommended by masters with deep C skills. But remember that there is no book suitable for everyone. It is recommended to refer to the book review on the ASSociation of C User website. Write a program to comply with C habits, avoid just change the syntax to C , and the style is still your previous language style. If you don't change the medicine, you will not get any gains. Learning Standard C As A New Language also discussed how to start learning C . Q: Can you teach me how to do homework? A: No, sorry. I will not help others do homework. I received too many such requirements, such as helping him do homework, helping him find the wrong thing in the program before deadline. Anyway, let an expert help you in a distant place will never be the best way to learn. Find a person with C experience to guide you. For a student, a good master is the best help. Perhaps because of this, the good teacher is not easy to find. Similarly, I will not recommend "good project" to do it. According to my experience, I have to know what kind of difficulty in his or her course, what kind of project is the most suitable, this is very spent. I want a good project is not that simple, but I want to know what this project is and how to implement it, I have to write a lot of things, I have to spend a few hours. I don't have much time to spend this, these requirements have almost every week. Finally, some students seem to think that if the project is my recommended, then I have to provide adequate help from him to finish this project. Recommendation: Go see TC PL3 or other excellent education books. Many exercises can make you busy for a few days, and do these exercises will also encourage people with heart to do something similar. Or you can also find a project from the world other than computer science: Maybe a biological project cannot use a new measuring device, or a learning history that cannot use an improved database. Many excellent projects and computers are not in traditional computer science fields. Go see my C style and techniques FAQ. The newcoming of programs that have just started writing "reading some data, handling them, producing some output", may be interested in a simple program or from entering a string. Q: Where is the free C compiler? A: Try RedHat Cygwin, DJGPP, or Borland5.5 for Cygnus. These can be run on the Wintel machine, and these compilers are working hard to the ISO standard. Mac users can go to Apple to see. WARNING: If you want to use a compiler for commercial purposes, you must first read the legal provisions and restrictions on it. A lot of ancient C compilers are also circulated on the Internet or CD. I don't recommend using the old compiler to learn C or develop new products. Because there is no need to spend an early way to deal with the BUG that has been resolved, or restrictions eliminated by the Standards Committee. To find a free high quality standard library (part), go to SGI's STL site and STLPORT. For more compiler information, please see my C compiler list. Q: Are you a Sweden? A: No, I am Danish. You can see my resume. Q: Is there any good way to improve my C program? A: I don't know. It depends on how you use C . Most people underestimate the abstraction and template, and use too much type of conversion and macro. You can find some of my opinions in my article or book.
Abstract classes and templates can be seen as an interface, which is clearer, more logical, and more logical than the function or single-rooted class hierarchies. I have more clear examples and opinions in my Style and Techniques FAQ. Q: Is it important to choose a programming language? A: Yes, but don't want a miracle. Some people may believe that a programming language can solve most of the problems in their system builds (or at least). So they do tirelessly look for perfect programming languages, but they have been disappointed. Others believe that programming languages are unimportant "implementation details", so they only invest in development processes and design methods, and can always program them with COBOL, C or some exclusive language. A good language - such as C - you can do a lot of things for designers and programmers, as long as you understand and pay attention to its strengths and restrictions. Q: Does the ANSI / ISO Standards Commission harmed C ? A: No, they (we) do well. You can get fit on the details (I am like this), but I am very satisfied with the ISO C language and the new standard library. ISO C is better than previous C versions, clearer. And standardized work began to start, you can now write more refined, more maintenance, better C programs. The new standard library is also a great advantage. List, Vector, Map, and various basic algorithms provided by standard libraries make your contact with C are greatly changed. You can refer to the chapter of the standard library in The C Programming Language (3rd Edition) (Chapter 3 A Tour of The Standard Library) or I have recently written an article. Q: When will there be a C standard? A: We already have! The final technical vote was at 10:30 am on November 14, 1997. Here is the press release released by the ISO C Standard Commission. After the technical vote, the C standard was approved in 1998. This is ISO / IEC 14882. The language and libraries in The C Programming Language (3rd Edition) are based on this. Providers in C compilers and libraries have been quite close to the draft sales and standards. Q: Where can I get an electronic version C standard? A: C Standard (ISO / IEC 14882) can purchase online in National Committee for Information Technology Station, National STANDARDS. When I wrote this article, the price is US $ 18.00 and can be paid online with a credit card. The downloaded file is PDF format, with a total of 2794KB. The draft of the post-standard process can be downloaded here. I want to remind you that the standard is not a tutorial, even if the expert programmer is also the best from the textbook to learn C and understand the new features of C . Q: Is there anything you want to delete in C ? A: Not too. People who ask this kind of problem usually think I will want to remove multi-inheritance, exception, template or RTTI (runtime type identification). If you don't have them, C is not complete. For many years, I have repeatedly reviewed the design of these features, and improved some details with members of other standard committees, but removed any of them, they have significant damage to C . From a language design point of view, I don't like the characteristics of the part C subset of C .
But for programmers in the real world, deleting this part of the feature will cause great trouble. C compatibility for C is an important language design decision, not just a marketing tool. Compatibility is really difficult to do and keep it, but this does make the programmer in reality, until today. Some of C now allows programmers to quit the most annoying C feature. For example, Vector, List, Map and other containers in the standard library and String can be used to avoid the most troublesome low-level pointer operations. Q: What is C 0x look like? A: I don't know. The launch of C 0x requires a lot of standardization process, and it is necessary to consider the needs of various members of the C community. The discussion of the direction of the ISO C standard (2003 version 2005 version?) Is now just starting. The current C standard remains stable for a long time, and C language will maintain a longer time, because compatibility is always an important consideration. I personally think that there are several important principles: language itself has no major change standard library will have major expansion
Any changes and extensions are to make C become a platform for better system programming and library creation, but also make C easier to learn. Of course, we will discuss the meaning of the two "major" above. I briefly expressed my thoughts at the SD2001W symposium, and made some more detailed details in the theme speech of the ACCU meeting in the spring of 2002. Note that this represents my personal view of C development, is not the decision of the Standard Commission. Q: When is ARM new version? A: Ellis and Stroustrup Complete The Annotated C Reference Manual Book, commonly known as "The ARM", written in 1989, it was the foundation of C standardization. Now it is too old, can't reflect the current C standard. Andrew Koenig and I are overwriting this book according to ISO standards. Because some troubles have been encountered when giving the reference standard text to ISO, this work is delayed. (I have considering the reference to other words, even if it is unfaithful for colleagues and friends of the Standards Committee, or will lead to dissatisfaction with the C community.) Our work is repeatedly delayed for "ARM ", so that I don't dare It is expected to be launched. Q: When will the fourth edition of THE C Programming Language? A: I think at least before 2004. The definition of C and the basic techniques it support will not change significantly before. When I wrote this book, the goal is to let it put more time on the bookshelf, and ISO C standard provides guarantees for basic stability. Therefore, the C Programming Language (3rd Edition) must reflect the standard C , standard libraries, and their support, not a particular implementation or a proprietary library. I will publish small changes and adding on "Online Maintenance", as well as improvements made when new print printing. Please refer to the errata. In 2000, the print version (including the "special edition" of the hard cover), I joined two appendices: Locales and Standard-Library Exception Safety. German translation calls "special edition" as the fourth edition. Q: Should I buy the special edition of THE C Programming Language? A: Of course, hurry to buy, buy more. :-) The difference between the latest printing of the third edition and special edition is only for hard cover packaging (of course, there is still the same price difference). If I am a C programmer who has not read THE C Programming Language (3rd Edition), I will buy any one of the two books. If I use it as a textbook and reference book, I often go to turn it, then I will choose the hard cover. Although the cover of the third edition is the best in the soft cover, it is better than the special edition of the hard cover. If I already have a third edition, then when it is turned by me, or when the version is too old, I will buy another special edition. The latest printing of the special edition and the third edition has been fixed to 1,000 errors compared to the first printing. As a user mainly working with C , I think this is very important. Two new appendices are also available in these two versions (around 100 pages, you can download: locales and standard-library exception safty. The existing content is not moved, so you can use the same page number to reference the third edition of the newly printed version and the contents of the content.
There is also an improved index. Q: Do you really sell X00,000 TC PL? A: Obviously, for some x values :-) If you calculate all the translation versions of my book, then the number will exceed 1,000,000. Of course, there are some piracy, but I will not have a way to calculate them. In addition, I don't sell books, I am just writing. There is no electronic version of my book. If you see something, it must be the piracy of copyright infringement. Q: Which C compiler is recommended? ? A: I will not recommend any compiler and library, I can't make it completely fair. However, it is recommended that you use the latest version of the compiler, because usually the new version of the compiler is closer to the ISO standard than a few years ago. Here is an incomplete C compiler list. Choose a standard library as much as possible without standardizing the so-called "base library", as little as possible with exclusive extension. Q: If you don't have to consider compatible with C, then the language you designed will not be Java? A: No, it will not be close to Java. If someone insists on comparing C with Java, I suggested that they read the Design and Evolution of C (D & E), they can see why C will look now, then according to my design standard set up to C , measure two Language. These standards are clearly different from the standards set up with Sun's Java team. Although the symptoms are very similar, C and Java are completely different languages. In many ways, Java is closer to SmallTalk, not C . Like most new languages, many relatively simple part of Java comes from the illusion, part from the incompleteness of functionality. As time passes, Java will significantly become more complicated, and its size will increase two to three times, and the implementation related extension features and libraries will also grow. This is a way of development of every business success. Don't believe you can look at any language you think of a wide success. I have not seen any exceptions, this phenomenon is naturally reason. Java is not a platform-independent, it is platform. Just like Windows, it is a proprietary business platform. That is, if you write programs for Windows / Intel platform or Java / JVM platform, your program is written for a platform that belongs to a separate company, which is left around the company's interests. Although some people pointed out that you can write programs for JVM and related operating system, JVM is strongly biased to Java, which is not even better than VM / OS neutral in language. In a person concern, I still insist on using C with fairly portability to do most of them, and do the rest in different languages. Q: How do you see C #? A: I have no comments on C #. It's hard to convince why I need another proprietary language in the world, it is more difficult to convince why I still need a language that combines a specific proprietary operating system. Obviously, I am not a fan of a special language, but an open formal standard fan. Q: For large projects, do you really recommend ADA? A: No. I don't know who this rumor is coming out, I think it is too fanatical or unsolicited ADA believers. Q: Do you want to compare C with a language? A: Sorry, I don't want to do this. You can find a reason in the Design and Evolution of C :
"Some critics ask me to compare C and other languages, but I don't want to do this. Therefore, I reiterate me to think: the language is very small, it is difficult to make a fair. Mainstream program design The comparison between language needs to spend a lot of effort, there is a need to have a wide range of applications, and it is necessary to maintain an independent justice. Most people will not spend so much energy. I have no such time, and as C Designers, it is difficult to let people believe that I can do it completely. I have a phenomenon, I am worried, this is repeated in the language comparison. Although some people really want to make serious language comparisons, and strive to maintain a fair position, but they Eventually to a certain aspect of the application, or a programming style. Worse, when a language is more famous than other languages, the comments will produce subtle transfer: the famous language defect is considered to be Sleeve, and simple solutions; similar defects in other languages will be considered fundamentally shortcomings. Solutions commonly used in less unsolicited languages often do not know more than comparative people, or It is not satisfactory because these methods cannot be used in languages they are familiar.
Similarly, information about those famous languages is usually the latest, and the comparative person will use old information. For two languages worthy of comparison, if it compares the Y language in the X language and the latest test three years ago, then this is not fair. So, my comments from other languages other than C are limited to general comments or for specific issues. "
That is to say, for the majority of users and various applications, I think C is your best choice. Q: Others will not be happy than others, will you not be happy than C ? A: If it is a one-sided comparison or for commercial purposes, I am really unhappy. The most popular comparison is often a supporter from a language (such as what is called Z language), the purpose is to prove that the z language is better than other languages. Because C is widely used, it is the first language that has become Z language supporters want to devalue. These articles are often published by companies that sell Z language. Surprisingly, many people will be written by company staff who are studying such sales Z language, and there is no article for expert review to prove that the z language is best. The problem is that there will always be some facts in this type of comparison. After all, there will be no language is better than other languages in all aspects. C is of course imperfect, but these choices will appease and sometimes be a misleading. When you see an article about language comparison, let's see who is written, and then carefully consider whether it is true and fair, and the author takes the comparison standard itself whether it takes into account the fairness of all languages. This is not easy. Q: You don't compare C and other languages, but why do you write criticize others because C ? A: I don't write a criticized article (that is a hostile description of some texts I wrote). I think as a language designer, there is reason (even responsible) to explain its advantages, and resist the malicious disintegration of it. You can take a look at the article I published. I also often point out the limitations of C and some basic hypothesis in C design (for example, D & E). Q: C is better for small projects, is it? A: I don't think so. I have never seen any project is better than C , unless it is a good C compiler. Q: Is C is a subset of C ? A: From strict mathematics, C is not a subset of C . Some legal C processes are not legitimate C programs, and even a few ways can write different codes in C and C . However, each programming technology C supported by C is supported. Each C program can be written in C in substantially the same method, and running time and spatial efficiency are similar. Things of tens of thousands of row ANSI C codes in a few hours of converting C code for C code. Therefore, C is an ultra-array of ANSI C, and ANSI C is a supercoming of K & R C, and ISO C is also a supercoming of C at 1985. Writing a well-written C-procedure is also a legal C program. For example, any example in "The C Programming Language (2nd Edition)" of Kernighan & Ritchie is a C program. Some examples of C / C compatibility issues: int main () {
Double SQ2 = SQRT (2); / * NOT C : Call undeclared function * /
INT S = SIZEOF ('a'); / * Silent Difference: 1 in C Sizeof (int) in C * /
}
Calling an undefined function is a bad style in C, which is illegal in C . Also give a statement that is not parameter-free, in C and C is also different: void f (); / * argument type not exercioned * / void g ()
{
f (2); / * Poor Style C. Not C * /
}
In C, void * can implicate to any pointer type, typical free storage assignment is made with malloc (), without any way to check if enough memory, for example: void * malloc (size_t);
Void f (int N)
{
INT * P = Malloc (N * SizeOf (char)); / * NOT C . in C , Allocate Using 'New' * /
Char C;
Void * pv = & c;
INT * PI = PV; / * Implicit Conversion of void * to int *. Not in c * /
}
Note, convert the void * to int * and hidden alignment issues. See alternatives for Void * and Malloc () in C . When you go from C to C , remember that the C is more than C. Some keywords: int class = 2; / * OK IN C. SYNTAX ERROR IN C * /
INT Virtual = 3; / * OK IN C. SYNTAX Error In C * /
In addition to listed several examples (there are more detailed lists in Appendix B) of C Standards and The C Programming Language (3rd Edition), C is a super-collection of C. (Appendix B can be downloaded) Q: What is the difference between C and C ? A: C is a direct progeny of C, which contains almost the entire C as a subset. C provides a stronger type check than C and supports more programming styles. Because C supports C language programming style while providing better type checks and more conceptual support, there is no loss efficiency, so in this sense, C is "a better C". Similarly, ANSI C is also better than K & R C. In addition, C also supports data abstraction, object-oriented programming and generic programming (see the C Programming Language (3rd Edition); Appendix B discussion C-compatibility issues, this chapter can be downloaded.) I have never seen a problem C is better than C (I don't believe there will be such a problem, because each C is clearly there is a C equivalent.) However, there are still some environment C can't support, and use C will have benefit. About C design and the discussion of the relationship with C, you can see The Design and Evolution Of C . Note that the C is referring to the classic C and C89 above. C is not the future generation of C99, C and C99 are brothers. Some of the features introduced by C99 may cause incompatibility of C and C . Q: Do you really think that C and C should merge into a language? A: If the incompatibility of C / C is completely eliminated, the future evolution is also organized to prevent new incompatibility, then if I want to be like this, I will have no doubt about the C / C community. It's a good thing. Of course, it can be another thing. My basic view is that the current C / C compatibility is due to historical reasons, there is no fundamental reason behind (although all the masters with good desires, all this is a good idea at the time ") . The incompatibility of C / C has nothing benefits to the community, but will cause serious problems for considerable parties. These incompatibility should be eliminated, although it will be difficult. Want to understand the details of the C / C compatibility problem, you can see a series of articles I wrote:
B. Stroustrup: C and C : Case Studies in Compatibility The C / C Users Journal To appear September 2002. B. Stroustrup:.. C and C : A Case for Compatibility The C / C Users Journal To appear August 2002... B. Stroustrup: C and C : Siblings. The C / C Users Journal. July 2002. B. Stroustrup: Sibling Rivalry: C and C . AT & T Labs - Research Technical Report. TD-54MQZY. January 2002.
I think if the incompatibility is really eliminated (C and C need to be modified), there will be C and C two languages, but C can really be truly referred to as a subset of C . Q: When is C invented? A: I started to design a new language since 1979, which later became C . The initial version is called "c with classes" (C) with class. The first version of C began in AT & T inside AT & T in August 1979. On the same year, I started using "C " name. The first commercial C compiler was released in October 1985 and published the first version of C Programming Language. Templates and abnormalities are joined in the late 1980s, which is described in the Annotated C Reference Manual and The C Programming Language (2rd Edition). Current C is defined by ISO C standards and describes the C Programming Language (3rd Edition). You can find a complete annual table and more detailed description at The Design and Evolution of C . Q: Why do you invented C ? A: I want to write efficient system programs with Simula67 style. To do this, I joined the C language to better type inspection, data abstraction and object-oriented mechanism. This work is a project about the network distribution operating system. More generalized goals are the language that can be written and highly and exquisite procedures. Many languages forced you to make a choice between the two. It caused me to start designing and implementing C (starting "c with classes" at the beginning) is a design task for distributed operating systems. You can find a more detailed description in The Design and Evolution of C . Q: Why is AT & T to support C development? A: AT & T needs to build a more complicated and more reliable system than others. Thus, we must impose an impact on the market, and help build the standards we need, otherwise we will not have the tools needed to build our system. It is also necessary to create language and tools to solve general problems. Similarly, teachers also tend to suit students and researchers' language and tools, even if they are not suitable for certain tasks. When I developed C , and when I first develop UNIX and C, AT & T may be the world's largest private software users (and consumers). We use many types of systems, from the smallest embedded processor to the largest supercomputer and data processing system. We need a development system that can be applied to a variety of technical fields and a variety of platforms. C and C are designed based on such requirements. Such versatility is the most basic requirement, and proprietary features are considered to limit the selection platform and vendors. Therefore, AT & T has always been the main supporters of regular standards such as ISO C and ISO C . In fact, AT & T also earned enough money by CFRONT (my earliest C compiler), and developed C investment has been doubled. Q: Do you have C ? A: No. If someone "has C ", it can only be ISO.
AT & T gives all the rights I have written to ISO. Now ISO C standard copyright belongs to ISO. Compiler vendors don't need to pay for me or AT & T for C . The ISO standard is originally free to use all people. (Of course, the copy of the standard specification is to buy money to ISO or National Standards Committee.) Q: Why is C no garbage recycling mechanism? A: If you want automatic garbage collection, there are some good business and public domain C garbage collectors available. In applications where garbage collection technology can apply, C garbage collection and other languages that support garbage collection are better than performance. There is a discussion on C automatic garbage collection in THE C Programming Language (3rd Edition). You can also go to Hans-J. Boehm's website about C / C garbage collection. Moreover, C also supports other memory management technology, and the memory can be managed without garbage collection. Q: Why is C "Hello World" program compile results 10 times more than C? A: Not this on my machine, you should not be like this. In fact, the target code generated by the "Hello World" generated in my machine is smaller than the C version. The reason why there is no language level will make one version than the other. This depends on how the compiler implementator organizes the library. If you find that a version is significantly large, you will report this question to the compiler. Q: Is the ancient language like C to compete with modern fashionable advanced language? A: Obviously, you call C as an ancient language means you have a bias (see legacy code). Put this first, people ask this question to usually think about Java or C #. Although I will not compare C and those languages, I still pointed out that "fashion" does not mean "better". The roots of Java and C # are OOPs in the 1980s, which is even more deeper than the early C . Since the start of 1987, the development focus and related programming styles of the C language began to use templates, static polymorphisms, generic programming and multi-model programming. This far exceeds the scope of the proprietary language that is largely specified. Another important difference is that C supports user-defined types to reach the same degree of built-in type, combined with templates, constructor, destructuring functions, and C programmers can use (I think) more advanced programming and Design technology, this is the language that is often brought to C compared. Standard C and its design programming technology owes a lot of functions, especially ML languages. ML Early Variety Type Due Mechanism (and many other things) is a source of inspiration for creating C templates. Some more efficient techniques in Functional Programming inspire the use of STL and C function objects. On the other hand, the functional programming community missed the wave of object-oriented programming, and their language and tools rarely benefited the mature experience of massive practice. Obviously, I don't think there is a programming language, and there is no garbage collection is the only decisive feature of the "advanced" or not. In particular, C provides a valid and efficient memory management technology, you don't need to use garbage collectors to eliminate resource leaks. If you don't agree, there are many good C garbage collectors that can be used.
Q: What is multi-model programming? A: Multiparadigm programming is "programming in a variety of style, each other can" fancy spell. For example, use generic programming when the object type is required to distinguish the object type at runtime, and use generic programming when needed, and pursue execution efficiency. Obviously, the main power of multi-model programming is embodied in a plurality of models (programming style) programs, so it is difficult to create the same effect by using a variety of languages that support different models. The most striking effect of multi-model programming is that if the technology from different regions is closely collaborated, it can write more refined and maintenance-free code than using a single-type program. Lift a simple example, traversing a polymorphic type of static type container to write: void Draw_all (Vector
For_each (vs.begin (), vs.end (), mem_fun (& shape :: draw);
}
Here, Shape * is an abstract base class defining a set type class hierarchy interface. This example can be easily extended to containers in any standard library: Template
{
For_each (cs.begin (), cs.end (), MEM_FUN (& Shape :: DRAW);
}
JIM Coplien's book "Multiparadigm Design for C " (Addison Wesley, 1998) explored a variety of models in design and design methods. Q: How do you see EC ? A: EC (almost) is a subset after C removes exceptions, templates, namespaces, RTTI support, multi-inheritance, etc., is defined by a "Industrial Alliance". I don't agree with the definition subordinum or dialect, especially the subset of the standard library, so that users must develop incompatible basic libraries. I am afraid to define the Son language of C caused the user group split and causes mutual attacks. (1999/3/31: I saw an advertisement with a vivid picture to illustrate how EC is "slimming" by abolishing the namespace, template, standard String and other things. Sigh.) I am more minded. Seminar (such as ISO or a national standard organization) works for "standard". I don't think it is necessary for embedded systems to define the sub-language or dialect of C . (See I in Spring'99 Embedded Systems Conference, the subject speech) embedded system development community should get a better support of a specialized group, this group will consider what is the need for embedding system development community and how C , and will document . Such different projects and organizations will have a reasonable basis to determine which part of C . The embedded system development community is diverse. Many people need templates, some people are using anomalies, and the namespace has no effect on the size and speed of the program. In the next few decades, only the language defined by the ISO C standard is enough flexible, universal, well defined, and can meet the needs of embedded system development societies. In the relatively small number of cases, standard C 's space and time consumption are really a problem (usually because the compiler is not optimal), then you can help optimize the code by compiling the switch (eg, some items and some After the compiler is turned off, there will be significant performance improvement, but not even). Q: Is the object-oriented concept of C comes from SmallTalk? A: Not. C Key Concept: Class, derived class, virtual function (in other words, the concept of encapsulation, inheritance and polymorphism) comes from Simula, just like SmallTalk. The metaphor is used by family relationship, C and Smalltalk are brothers. Q: Is C Is it object-oriented language? A: C is a multi-field programming language that supports object-oriented and other useful programming styles. If you want to find a language that you are doing in a way, then C is not what you want to find. There is no correct way to write all programs, even if there is such a method, it is impossible to force all programmers to use it. That is to say, using C to write C style programs for most applications are not the best way of use of C . To become a real C master, you must use abstract mechanisms and type systems reasonably and meet their original intentions. Trying to ignore or defeating C type systems will allow you to suffer serious setbacks. Like C Write a SmallTalk style and write C style programs, it is not an ideal way to make people discourage. For more detailed discussions, you can see the article about instructions and style in my reference.
Especially my OOPSLA paper "Why C isn't Just An Object-Oriented Programming Language". Q: Is that really what you said? A: Yes, I said that "C is easy to make you shot your feet when you shoot, C is not so easy, but if you really do it, it will put your whole leg". " But people tend to or ignore, I am correct for any powerful language to varying degrees. When you prevent people from making a simple mistake, they will start making new, less than a significant mistake. Those who can avoid simple mistakes may go straight to the simple mistake. For a rugged environment, there is a problem, that is, the problem is always discovered too late, so that it is difficult to remedy once it is found. And, rare issues are more difficult than common problems because you often don't doubt it. I also said that there is a smaller and clearer language in C , which is struggling to come out. " For example, the original article can be found in the 207 page of The Design and Evolution Of C (the translation: Chinese version 156). However, this smaller and clearer language is not Java or C #. The original article is in the section called "Beyond Files and Syntax". It refers to the semantics of C to be much clearer than its grammar. I am considering a programming style, a library and programming environment, and relatively focused on the ancient usage of the low level of C, they emphasize clearer and more effective programming practices. Q: Is that IEEE is true for your interview? A: Yes, that confession, deliberately designed C as a bad language, so that it is difficult to maintain code to increase the interview of programmer salary? That's of course not true. Real IEEE interview here. Q: What is "Heritage Code"? A: "Legacy Code" is usually used as a derogatory word, which is used to express the language or style written by some author thinks that it is obsolete or with his sales. "Heritage Code" is often unfair to work or unable to expand. Q: Why is it called C ? A: In the beginning of the year, I called my language "c with classes". However, people always call it "new c", and later referred to as "C". This results in the original C known as "Plain C", "Straight C" and "OLD C". The last name is proud, so I start looking for a new name for politeness and avoid confusion. I chose C , because it is short, there is a good explanation, and is not "what C" form. In C, depending on the context, can be read into "next", "successor" or "increment", although it is often read "Plus Plus". C This name and the second candidate C are fertile soil that produces jokes and buds, many of which are famous before this name is determined, and people also appreciate them. C This name is Rick Mascitti suggestion, the earliest use is in December 1983. At least one play language is called D. There are more trivial things about naming in D & E. Q: Is the number of C users now grow up each year? A: No. In 1980 to 1991, the number of C users will double each 7 and a half months (see The Design and Evolution Of C ). However, it is obvious that there is not enough programmer to maintain such growth rates.