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

[color=red][b]Chapter 1. Getting Ready[/b][/color]

[b]Whence C?[/b]
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.

[b]Why C?[/b]
Design Features:Efficiency,Portability,Power and Flexibility,Programmer Oriented
Shortcomings:pointers cause errors difficult to trace, Obfuscated Code contest
[img]http://www.hidetoishandsome.cn/sitemedia/public/virtues.jpg[/img]

[b]Whither C?[/b]
C++ is nearly a superset of C, meaning that any C program is, or nearly is, a valid C++ program, too.
[img]http://www.hidetoishandsome.cn/sitemedia/public/where.jpg[/img]

[b]What Computers Do[/b]
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.

[b]High-level Computer Languages and Compilers[/b]
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.

[b]Using C: Seven Steps[/b]
The moral here is that you should develop the habit of planning before coding.
[img]http://www.hidetoishandsome.cn/sitemedia/public/steps.jpg[/img]

[b]Programing Mechanics[/b]
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.
[img]http://www.hidetoishandsome.cn/sitemedia/public/compiler_linker.jpg[/img]
[img]http://www.hidetoishandsome.cn/sitemedia/public/unix_c.jpg[/img]

[b]Language Standards[/b]
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)

[b]Summary[/b]
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.

[b]Review Questions[/b]
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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值