版本7和8间的区别
于2006-06-20 20:12:37修订的的版本7
大小: 2285
编辑: czk
备注:
于2006-06-20 20:15:41修订的的版本8
大小: 2294
编辑: czk
备注:
删除的内容标记成这样。 加入的内容标记成这样。
行号 26: 行号 26:
 1. ["/4.11.1 File Inclusion"]
 1. ["/4.11.2 Macro Substitution"]
 1. ["/4.11.3 Conditional Inclusion"]
    1. ["/4.11.1 File Inclusion"]
    1. ["/4.11.2 Macro Substitution"]
    1. ["/4.11.3 Conditional Inclusion"]

Navigation(slideshow)

Chapter 4 - Functions and Program Structure

Functions break large computing tasks into smaller ones, and enable people to build on what others have done instead of starting over from scratch. Appropriate functions hide details of operation from parts of the program that don't need to know about them, thus clarifying the whole, and easing the pain of making changes.

C has been designed to make functions efficient and easy to use; C programs generally consist of many small functions rather than a few big ones. A program may reside in one or more source files. Source files may be compiled separately and loaded together, along with previously compiled functions from libraries. We will not go into that process here, however, since the details vary from system to system.

Function declaration and definition is the area where the ANSI standard has made the most changes to C. As we saw first in Chapter 1, it is now possible to declare the type of arguments when a function is declared. The syntax of function declaration also changes, so that declarations and definitions match. This makes it possible for a compiler to detect many more errors than it could before. Furthermore, when arguments are properly declared, appropriate type coercions are performed automatically.

The standard clarifies the rules on the scope of names; in particular, it requires that there be only one definition of each external object. Initialization is more general: automatic arrays and structures may now be initialized.

The C preprocessor has also been enhanced. New preprocessor facilities include a more complete set of conditional compilation directives, a way to create quoted strings from macro arguments, and better control over the macro expansion process.

  1. ["/4.1 Basics of Functions"]
  2. ["/4.2 Functions Returning Non-integers"]
  3. ["/4.3 External Variables"]
  4. ["/4.4 Scope Rules"]
  5. ["/4.5 Header Files"]
  6. ["/4.6 Static Variables"]
  7. ["/4.7 Register Variables"]
  8. ["/4.8 Block Structure"]
  9. ["/4.9 Initialization"]
  10. ["/4.10 Recursion"]
  11. ["/4.11 The C Preprocessor"]
    1. ["/4.11.1 File Inclusion"]
    2. ["/4.11.2 Macro Substitution"]
    3. ["/4.11.3 Conditional Inclusion"]

Navigation(children)

TCPL/4_Functions_and_Program_Structure (2008-05-22 11:44:47由czk编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.