c语言编译步骤2018/11/26

1:edit编辑器 此时程序员打码;
2:preprocesser预处理器 在预处理阶段,主要处理三类:

  • #define
  • #include
  • #ifdef
#define

1.symbolic constants符号常量 (替换宏)
#define identifier replacement-text
e.g. #define PI 3.1415927 (规定符号常量由大写和下划线组成)
2.macros 和符号常量一样在编译前完成替换
a symbolic constant is a type of macro;
一样是替换,只是可以接受一个或多个参数;

一般建议各级运算都要括号括起来,因为这种替换是文本替换;
use #undef to undefine symbolic constants or macro;
and then a name can be redefined ,or it will throw an error;

文件包含#include

#include <> only search in the pre-defined directories
which means predesigned compiler and system directories
#include “” first search in the same directory as the file to be compiled ,if not find,go to search in the pre-designed compile and system directory;

条件编译conditional compilation

it evaluates a constant integer expression.
Cast expression ,sizeof expression and enumeration constants cannot be evaluated in preprocessor directives.
every #if construct ends with #endif ;
may use #elif and #else which is the equivalent of else if and else ;

可以用来嵌套注释
#if 0
code prevented from compiling
#endif

当然还有如下的

#error token
#pragma
#line
assert()

3.compile编译,主要起到检查sytax error 的作用,生成目标代码;
4.link链接,这里是把各个文件和库的目标代码连接在一起的作用。
注意和include的区别,include是包含头文件,但是函数还是在.c文件里面,靠linker链接在一起。
5loader 把程序读进内存
6cpu执行

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值