First, C Design Goals (C Design AIMS) C design goals are to let C have both adaptability and efficiency of C language suitable for system program design, but also have like SIMULA-like language facilities (such program organization structure supported by Simula is often referred to as object-oriented programming style). When designing, it has also been made great efforts to make a high-level programming technology from Simula can be applied to system programming. That is to say, the abstract mechanism provided by C can be applied to those programming tasks that have high efficiency and adaptability. The above-mentioned C design objectives can be summarized: For programmers to solve practical problems, C makes programming more fun; C is a general purpose programming language, which: - is a better C; - support data abstraction; - support object-oriented programming; - Support paradigm design. The support for the design of the model program is achieved in the later stage of C design as a clear, independent goal. In most of the time in the C evolution process, I have been designing the model program and supporting its language characteristics under the headline of "data abstraction". Second, C Design Principle (Design Principles) In [Stroustrup, 1994], C design rules are divided into basic rules, based on design rules, language technical rules, and four aspects based on low-level programming rules, Leads herein. [Basic Rules] A: C Evolution and Development must be caused by practical problems; B: C is a language, not a complete system; C: Can't stop uncomfortable D: C in its existence "at that time" must be useful; E: Each language characteristics must have a dependent, clear implementation; F: Method can always provide a method; G : Can provide easy-to-understand support for each program design style that is intended to support; H: Not forced to people. It can be noted that the last three of the basic rules suggest two points: emphasis on the convenience of various applications applicable to the real world; full consideration of programmers' technology and orientation (preference). From the beginning, C is the programmer who wants to do practical projects. The so-called "perfect" is considered to be impossible, which is because C users have too much difference in demand, background and problem solving. Moreover, in the entire survival of the programming language of a general purpose, even the interpretation of the term "perfect" may have a great change. It can be seen that during the evolution of the language, the experience from the user's feedback and language implementation is most important. [Design-Support Rules] A: Supports a good design; B: Provides language facilities for program organization; C: Say What you mean; d: All language features must have Effective tolerance; E: Opening a useful feature is more important than avoiding all misuse; f: Can combine independently developed components into complete software.
One goal of C is to provide more ease of use and have certain capacity design ideas and programming techniques to further improve the quality of the program. Most of these technologies are from Simula, and is usually discussed as object-oriented programming and object-oriented design ideas. However, C design goals always support various programming styles and design ideas within a certain range. This is a certain contrast with the viewpoint of language design. Generally attempting to construct all systems in a single support, it is always necessary to support all systems, with mandatory programming styles (or model paradigm).
[Language-Technical Rules] A: There is no inherent conflict with the static type system. Very good support; C: localization (Locality) behavior is desirable; D: Avoid generating sequential dependencies; E: When doubtful to the language, you can choose the most easy to master in its characteristics; f: Yes Because of the use of improper syntax (Syntax Matters (OFTEN In Perverse Ways) G: Weaken the use of the preprocessor. Of course, these rules should be considered in conjunction with more context environments with respect to basic goals. It should be noted that the three aspects of "having a higher compatibility", "no loss efficiency", "no loss efficiency" and "to solve the actual problem", "complete type security "The" complete versatility "and" perfect abstract beauty "have been opposed. C draws on the user-defined type and class hierarchy mechanism from SIMULA. However, in SIMULA and many similar languages, their customization of user-defined support is fundamentally different from their support for built-in. For example, SIMUL is not allowed to customize the type of object allocation space for the user in the stack, and these objects are allowed to be allowed to be accessed by pointers (this is called reference -Reference in SIMULA). Conversely, the built-in object is only assigned space in the stack, and cannot be assigned in the dynamic storage area, and the pointer cannot be used. This difference in the treatment of internal construction and treatment of user-defined types implies strict considerations for efficiency issues. For example, when the object is a reference to the object assigned in a dynamic storage area, if the object belongs to a custom type (such as Complex), it will bring a load to the running period and space; and these loads are in some applications. It is considered unacceptable. These are the issues that C intend to get resolved. At the same time, the different uses is also determined: it is impossible to treat the models from the semantic approaches in the model program design. When maintaining a larger program, a programmer inevitably makes some modifications to the program based on certain incomplete knowledge, only pays only a small part of all program code. Based on this, C provides Class, NameSpace, and access control, making it possible for design decisions. In a language based on one-pass compiration, some dependence on certain order is inevitable. For example, in C , a variable or function cannot be used before it is declared. However, the name rules of C members and the rules of overload resolution are set out in principle independent of the declaration order to minimize the possibility of chaos and errors.