历史
Binary Instructions for CPU
在早期计算机cpu运行的都是二进制的指令,程序员就直接编写指令代码。
The instructions for CPU to run are binary.
下面这串数字是一个16位的计算机指令,也是16个01的组合,可以打印到纸带上,代表一个操作指令代码。
10110000 01100001
Programming on punched tapes
![]() |
![]() |
---|---|
Assembly languages
![]() |
Assembly languages are more human readable10110000 01100001 -> MOV AL, 61h ; 汇编语言,用人可以理解的指令,来跟16位计算机指令相对应。 - MOV AL, 61h; :把16进制的61(10进制的97)装载到寄存器中。- Load AL with 97 decimal (61 hex) |
---|---|
大多用在操作系统的底层代码,特别像操作系统的驱动的时候,主要就是用汇编语言完成。
High Level Languages
C: 1973
- Developed by Dennis Ritchie and Ken Thompson at Bell Labs between 1969 and 1973.
C++: 1979
- Created by Bjarne Stroustrup as an extension of the C programming language
- 设计思想:在C语言上加上class类(C with Classes),面向对象编程
C with Classes
Renamed toC++
- Now it’s C++++++++++(更新迭代出众多版本,C++98、03、11、14、17、20 …)
Java: 1995
- I hate memory management in C/C++(C/C++没有内存管理,bug++)!
- JAVA采用自动内存管理,不用手动申请和释放内存,bug—
- I want “Write once, run anywhere”, not “write once, compile anywhere”.
- JAVA可以跨平台,编译成字节码文件(中间文件),然后在所有的平台上运行。
- C++也跨平台,但是在不同的平台上如果要使用需要去重新编译,才能运行。
- Grammar is similar with C++. C++的子集
- A Java compiler generates
*.class
files, not executable files.- C/C++是编译语言,可以直接生成可执行程序;
- JAVA是解释型语言,编译器生成字节码class文件,然后用JAVA虚拟机读字节码文件,在JAVA虚拟机上运行
Python: 1990
- 脚本语言
- I hate strict grammar!
-
Even higher
可视化编程语言,一般用于儿童编程。
Scratch: 2002 I don’t like to type a keyboard |
|
| | —- | —- |
C++ 的难点
C++的优势
- Development language of most fundamental computer systems
- Linux
- MySQL
- OpenCV
- Backend of TensorFlow, PyTorch
- High efficiency
- Widely optimized compilers -> 完善的编译器
- Access memory directly -> 直接访问内存
- Excellent on computing -> 计算效率高
- Important language for AI algorithm implementatio -> AI应用的落地