当前位置:网站首页>C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.1 The Prehistoric Phase of the C Language
C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.1 The Prehistoric Phase of the C Language
2022-08-01 21:09:00 【weixin_Guest time】
The C language was born from a failed project---the Multics project.This project attempts to build a very large operating system that can be applied to very small hardware systems.Multics became a treasure trove of engineering lessons, but it also paved the way for C to embody "small is beautiful".
Ken Thompson Dennis Ritchie
Thompson PDP-7 New Operating System (Assembly Language)
Brian Kernighan 1970 named UNXI(1970.1.1)
Thompson created the B language, which he used for researchThe language BCPL has been simplified so that B's interpreter can reside in the PDP-7's only 8KB of memory.Because of the memory constraints of the hardware system, it only allowed to place an interpreter, not a compiler, and the resulting inefficiency prevented the use of the B language for system programming of UNIX itself.
1965-7 (BCPL)---"1969 (B)---"1971 (New B)---"1972-3 (early C)
Language
UNIX (with PDP-7 written in assembly language)---"UNIX (written in PDP-11 assembly language)---"UNIX (written in C)
Operating system
PDP-7 PDP-11
IBM 360
Honeywell 635
Exactly, UNIX appeared earlier than C (that's why UNIX's system time is measured in seconds from January 1, 1970, because that's when it was created.
Golden Rule for Compiler Designers: Efficiency is (Almost) Everything
Things to Care About: Meaningful Error Messages; Good Documentation; Product Support
Compiler efficiency includes: running efficiency (the speed at which the code runs) and compilation efficiency (the speed at which executable code is generated).Except for some development and learning environments, operational efficiency plays a decisive role.
There are a number of compiler optimizations that increase compile time, but reduce run time.There are also optimizations (such as weeding out dead code and ignoring run-time checks, etc.) that reduce compile time and run time while reducing memory usage.The downside of these optimizations is that invalid running results in the program may not be discovered.
Dennis Ritchie invented the efficiency-focused "New B" and succeeded.
B language promotes the idea that "referencing an array element is equivalent to a reference to a pointer plus an offset".The B language also maintains the typeless characteristics of the BCPL language, and its only operand is the word of the machine.Thomposon invented the ++ and -- operators and added them to the PDP-7's B compiler.They still exist in the C language.
// In C, the statement that copies one character of a string:
*p++ = *s++;
can be compiled into PDP-11 code extremely efficiently:
moveb (r0)+, (r1)+
Thompson PDP-11 (Assembly)
After PDP-11, untyped languages quickly became anachronistic.This processor features hardware support for several data types of different lengths that the B language cannot express.
"New B"->C uses compilation mode to introduce the type system, and each variable must be declared before use.
边栏推荐
猜你喜欢
Questions I don't know in database kernel interview(1)
正则表达式
property语法
包含吲哚菁绿的多聚体白蛋白纳米球/载马钱子碱纳米粒的牛血清白蛋白微球的制备
LeetCode·32.最长有效括号·栈·动态规划
图的邻接矩阵存储
JS Improvement: Handwritten Publish Subscriber Model (Xiaobai)
网络安全与基础设施安全局(CISA):两国将在网络安全方面扩大合作
Hiking, cured my mental internal friction
Interview Blitz 70: What are sticky packs and half packs?How to deal with it?
随机推荐
ISC2022 HackingClub white hat summit countdown 1 day!Most comprehensive agenda formally announced!Yuan universe, wonderful!
C陷阱与缺陷 第7章 可移植性缺陷 7.8 随机数的大小
MySQL Syntax Basics
位运算简介
C语言之字符串函数二
R语言 pca主成分分析的主要方法
图片识别商品接口 API:天猫淘宝
C专家编程 第1章 C:穿越时空的迷雾 1.2 C语言的早期体验
C陷阱与缺陷 第8章 建议与答案 8.1 建议
LeetCode·32.最长有效括号·栈·动态规划
附录A printf、varargs与stdarg A.2 使用varargs.h来实现可变参数列表
ahooks 是怎么处理 DOM 的?
Excel advanced drawing techniques, 100 (22) - how to respectively the irregular data
C陷阱与缺陷 第7章 可移植性缺陷 7.7 除法运算时发生的截断
Interview Blitz 70: What are sticky packs and half packs?How to deal with it?
测试开发人均年薪30w+?软件测试工程师如何进阶拿到高薪?
system collection
Based on FPGA in any number of bytes (single-byte or multibyte) serial port (UART) to send (including source engineering)
JS提升:手写发布订阅者模式(小白篇)
JS Improvement: Handwritten Publish Subscriber Model (Xiaobai)