Introduction to C Memory Management and C++ Object-Oriented Programming

     复习c/c++中关于指针对内存操作,指针是c的灵魂。偶然发现mit 6-088课程,非常适合这个主题。自学之。

1.什么时候使用指针

     ①.堆上分配内存时

     ②.当给被调用函数传参时,希望其改变其值时

     ③.为了效率--避免拷贝数据结构


2  gcc编译的过程

   Preprocessor
Translation of # directives.

Translates all macros (#DEFINE’s) into inline C code.

Takes #include files and inserts them into the code.

Get redefinition error if structs etc. are defined more than once!

Use #ifndef directive to define things only if they have not been defined.
#ifndef HEADER NAME
#define HEADER NAME
/∗ Header code here

#endif

Parsing and translation
Translates to assembly, performing optimizations.
Assembler
Translates assembly to machine instructions.
Linking

Static. For each function called by the program, the assembly to that function is included directly in the executable, allowing function calls to directly address code.

Dynamic. Function calls call a Procedure Linkage Table, which contains the proper addresses of the mapped memory


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值