`
hideto
  • 浏览: 2649450 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

C Primer Plus 阅读笔记 Chapter 1. Getting Ready

阅读更多
Chapter 1. Getting Ready

Whence C?
Dennis Ritchie of Bell Labs created C in 1972 as he and Ken Thompson worked on designing the Unix operating
system.C didn't spring full-grown from Ritchie's head, however. It came from Thompson's B language.

Why C?
Design Features:Efficiency,Portability,Power and Flexibility,Programmer Oriented
Shortcomings:pointers cause errors difficult to trace, Obfuscated Code contest


Whither C?
C++ is nearly a superset of C, meaning that any C program is, or nearly is, a valid C++ program, too.


What Computers Do
First, everything stored in a computer is stored as a number.
Second, computer programs ultimately have to be expressed in this numeric instruction code, or what is called
machine language.

High-level Computer Languages and Compilers
High-level languages, such as C, Java, and Pascal, describe actions in a more abstract form and aren't tied
to a particular CPU or instruction set.
Also, high-level languages are easier to learn and much easier to program in than are machine languages.

Using C: Seven Steps
The moral here is that you should develop the habit of planning before coding.


Programing Mechanics
An object file and an executable file both consist of machine language instructions.
However, the object file contains the machine language translation only for the code you used, but the
executable file also has machine code for the library routines you use and for the startup code.



Language Standards
The first edition of The C Programming Language by Brian Kernighan and Dennis Ritchie (1978) became the
accepted standard, usually referred to as K&R C or classic C.
The "C Reference Manual" in that book's appendix acted as the guide to C implementations.
However, although this appendix defined the C language, it did not define the C library.
In the absence of any official standard, the library supplied with the Unix implementation became a defacto
standard.
The First ANSI/ISO Standard:
American National Standards Institute (ANSI) established a committee (X3J11) in 1983 to develop a new
standard, which was adopted formally in 1989. This new standard (ANSI C) defines both the language and
a standard C library. The International Organization for Standardization adopted a C standard (ISO C)
in 1990. ISO C and ANSI C are essentially the same standard. The final version of the ANSI/ISO standard
is often referred to as C89 (because that's when ANSI approval came) or C90 (because that's when ISO
approval came). Also, because the ANSI version came out first, people often used the term ANSI C.
The C99 Standard:
In 1994, work began on revising the standard, an effort that resulted in the C99 standard.
These three points—internationalization, correction of deficiencies, and improvement of computational
usefulness—were the main change-oriented goals.
The upshot is that C99 changes preserve the essential nature of C, and C remains a lean, clean, efficient
language.
Most compilers at this time don't fully implement all the C99 changes(in 2004)

Summary
C is a powerful, concise programming language. It is popular because it offers useful programming tools
and good control over hardware and because C programs are easier than most to transport from one system
to another.
C is a compiled language. C compilers and linkers are programs that convert C language source code into
executable code.
Programming in C can be taxing, difficult, and frustrating, but it can also be intriguing, exciting, and
satisfying.

Review Questions
1: What does portability mean in the context of programming?
A1: A perfectly portable program is one whose source code can, without modification, be compiled to a
successful program on a variety of different computer systems.

2: Explain the difference between a source code file, object code file, and executable file.
A2: A source code file contains code as written in whatever language the programmer is using. An object
code file contains machine language code; it need not be the code for a complete program. An executable
file contains the complete code, in machine language, constituting an executable program.

3: What are the seven major steps in programming?
A3: 
Defining program objectives.
Designing the program.
Coding the program.
Compiling the program.
Running the program.
Testing and debugging the program.
Maintaining and modifying the program.

4: What does a compiler do?
A4: A compiler translates source code (for example, code written in C) to the equivalent machine language
code, also termed object code.

5: What does a linker do?
A5: The linker combines translated source code with library code and start-up code to produce an executable
program.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics