Reread "Programmer" "C ++ Father" interview

xiaoxiao2021-03-06  45

Time: October 2002

Venue: Beijing Xiyuan Hotel

Character: DR. Stroustrup and "Programmer" Reporter Bear Festival

1: New standard for C

In 1998, the C standard was passed in 1998. The new standard will appear in 2005. I thought of the postponement of whidbey, whether it is related to this new standard.

Two: C and embedded software

Definition of embedded software: Any software running on a non-traditional computer belongs to this field. The fundamental requirements for embedded software development to PL are: runtime efficiency, memory usage, and predictability. The C can be designed to support the above intent in situations where resources are limited.

a predictability

When a Virtual function is called, its overhead is fully predicted. At the same time, when using local variables, the object in the static global domain, the object overhead can be well predicted.

b. memory usage

If you need to use dynamic memory, you can use a memory pool; or even GC (of course, in the case where there is no time limit).

C. Run Efficiency

Using C can be designed to not involve OO code, and the good compatibility of standard C is also the reason why it is also selected.

About the efficiency problem of C runtime, you can refer to:

http://arubis.dkuug.dk/jtc/sc22/wg21/docs/papers/2002/n1396.pdf

2: Managed C

HERB SUTTER said ISO will consider adopting M C to develop international standards.

Dr. Stroustrup: Each platform provider expands the language to compatibility with the platform with the OS. And .NET's platform is different from the general C interface.

Three: Is C is the best language

It is well known that today's language can be divided into two genitals, dynamic languages ​​and static languages.

Dynamic Language: Ruby, Python, C #, Java

For example, Ruby provides development methods and language mechanisms. Agile Development Methode represented by Rebert Martin.

But the language of the last dynamic type is a language that must have a static type of language.

Python Features:

The programming mode is different from C , but it is easy to interact with C , which contains C internal library. Representative characters in the study of Python and C are David Abrahams.

The characteristics of Cyclone language:

Mainly by the University of Connell and AT & T, the characteristics are: eliminated insecure structures, increasing new structures to add their performance.

The language representative of the static type is C / C :

Advantages: Predictive and efficiency

Disadvantages: Security - "wild pointer", "buffer overflow"

Target and Ideal Realm: Type Safety Language

Usually Solution: Safety Language, running on the virtual machine, providing a more stringent object touchpad, but the paradox is: the virtual machine is essentially a static type language.

The conclusion is that it is impossible to solve security from the perspective of software, and it is necessary to start from the perspective of hardware.

4: C is a multi-style multi-paradigm language

The significance is to combine the most appropriate problem selection. At present, the development direction of C is "development rules, guiding the development of multi-model programming."

At this stage, it is in the exploration period of the template limit. The next stage will use the new language tool to simplify the code of the template, using the language tool to simplify GP. 5: Object management method in C

The concept of "value" and "reference object" is displayed in C . The C is based on "value", which is to put it in the container is an actual object rather than its reference, which will bring a high price to the copy movement. The solution is that the pointer is placed in the container, and once a pointer is with a pointer, you must consider the problem of the object lifecycle. You can make your own container, let it destructively destructure the objects they have.

The Solutions in Boost is: Provide a counting pointer - Shared Pointer, relying on the quotes to provide automatic management.

The shortcoming of GC is that only memory is managed, and for mutex, file handles, memory chunk is not helpful.

The technical point of memory CHUNK is: a large number of memory placed several objects, while recycling, the entire CHUNK is recovered once, which greatly improves efficiency, and can reduce memory fragmentation.

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

New Post(0)