目录

  • 程序的生命周期
    • 一、引言
    • 二、程序经历的六个阶段
      • 1、阶段一:编辑(Edit)
      • 2、程序编译系统(Programs Compilation System)
        • 阶段二:预处理(Preprocess)
        • 阶段三:编译(Compile)
        • 阶段四:汇编(Assemble)
        • 阶段五:链接(Link)
      • 3、阶段六:执行(Execute)

程序的生命周期

一、引言

什么是计算机系统(Computer System)?

计算机系统是一起工作以运行计算机程序(Computer Program)的硬件和软件组件(hardware and software components)的集合

什么是计算机程序(Computer Program)

计算机程序是针对计算机的指令(instructions)

计算机程序是如何在计算机系统上运行的?

二、程序经历的六个阶段

  1. 编辑(Edit)
  2. 预处理(Preprocess)
  3. 编译(Compile)
  4. 汇编(Assemble)
  5. 链接(Link)
  6. 执行(Execute)

1、阶段一:编辑(Edit)

在编辑器中编写代码

如下所示:hello.c

//hello.c
#include<stdio.h>
int main(){printf("hello,world!\n");
}

2、程序编译系统(Programs Compilation System)

如图所示:

阶段二:预处理(Preprocess)

在源代码编译之前对其进行一些文本性质的操作。它的主要任务包括:

1、删除注释
2、插入被#include指令包含的文件的内容
3、定义和替换由#define指令定义的符号
4、确定代码的部分内容是否应该根据一些条件编译指令进行编译

条件编译简单语法形式如下:

#if constant-expressionstatements
#endif

constant-expression :(常量表达式)由预处理器求值,如果值为非零(真),那么statements部分就被正常编译,否则预处理器就安静地删除它们。

条件语句常用于调试:例如,将你所有调试代码都以下面这种形式出现:

#if DEBUGprintf("x=%d,y=%d\n",x,y);
#endif

这样,不管我们想编译还是忽略这个代码都很容易做到。
如果想编译它,只要使用:

#define DEBUG 1

如果想忽然它,只要使用:

#define DEBUG 0

使用命令gcc -E hello.c > hello.i生成相应的hello.i文件
文章最后会贴hello.i文件,属实有点长了

阶段三:编译(Compile)

按顺序分为三个过程:语句分析、中间代码生成、代码优化
语句分析
对整体代码进行扫描处理,对代码进行词法分析,语法分析,语义分析,以排除不合法的、不规范的代码。

词法分析:关键字的正确性、标识符的有效性、立即数的展开。
语法分析:变量命名规范、程序结构合法性、函数定义的正确性、重定义现象等
语义分析:表达式的合理性、变量未初始化使用等。

中间代码生成

中间代码生成是产生中间代码的过程。所谓“中间代码”是一种结构简单、含义明确的记号系统,这种记号系统复杂性介于源程序语言和机器语言之间,容易将它翻译成目标代码。
另外,还可以在中间代码一级进行与机器无关的优化。

使用命令gcc -fdump-tree-all hello.c,然后查看.cfg文件,就可以看到生成的中间文件了
hello.c.013t.cfg:

;; Function main (main)main ()
{<bb 2>:__builtin_puts (&"hello,world!"[0]);return;}

代码优化

代码优化是指对中间代码进行等价(指不改变程序的运行结果)变换
等价的含义是使得变换后的代码运行结果与变换前代码运行结果相同。
优化的含义是最终生成的目标代码短(运行时间更短、占用空间更小),时空效率优化。

使用命令gcc -S hello.c生成hello.s文件(汇编语言)
hello.s:

 .file   "hello.c".def ___main;    .scl    2;  .type   32; .endef.section .rdata,"dr"
LC0:.ascii "hello,world!\0".text.globl    _main.def   _main;  .scl    2;  .type   32; .endef
_main:
LFB6:.cfi_startprocpushl    %ebp.cfi_def_cfa_offset 8.cfi_offset 5, -8movl  %esp, %ebp.cfi_def_cfa_register 5andl   $-16, %espsubl  $16, %espcall   ___mainmovl $LC0, (%esp)call    _putsleave.cfi_restore 5.cfi_def_cfa 4, 4ret.cfi_endproc
LFE6:.def   _puts;  .scl    2;  .type   32; .endef

编译时将变量名替换为内存地址,变量名编译完之后就不存在了
这里说的变量的内存地址是虚拟内存地址。这里的虚拟内存地址是固定的,而物理内存地址是随机的,内存使用时,才将虚拟内存映射到物理内存页

阶段四:汇编(Assemble)

针对生成的汇编代码,将其逐句解析转换生成一一对应的机器码(二进制编码)。
注意这个阶段之后才生成了二进制文件。

阶段五:链接(Link)

为什么要链接?

一个项目中有很多源文件和依赖库
源文件之间存在依赖关系
每个源文件都是独立编译的,即每个.c文件会形成一个.o文件
综上:为了实现依赖关系,需要将该.o文件中依赖的其他.o文件导入进来,这便是链接。

链接分为:静态链接和动态链接
静态链接

静态链接是以目标文件为单位的,如hello.c中,我们需要引用了静态库中的printf()函数,那么链接器就会把库中包含printf()函数的那整个目标文件都链接进来。

如果我们有几个.c文件中都用到了printf()函数

这几个.c文件都会把库中包含printf()函数的那整个目标文件都链接进来。

缺点:

那么同一份目标文件就被复制了好几份,占用的空间大。
同时,如果这个目标文件需要更新,需要重新进行编译链接形成可执行程序

优点:

优点就是,程序执行的时候已经包含了所有的函数,速度快。

动态链接

动态链接的基本思想是把程序按照模块拆分成各个相对独立部分,在程序运行时才将它们链接在一起形成一个完整的程序,而不是像静态链接一样把所有程序模块都链接成一个单独的可执行文件。
操作系统负责将需要的动态库加载到内存中,然后程序在运行到指定的代码时,去共享执行内存中已经加载的动态库可执行代码,最终达到运行时连接的目的。

如果我们有几个.c文件中都用到了printf()函数

第一个.c文件会把库中包含printf()函数的那个目标文件加载到内存中。
当其他.c文件发现那个目标文件已经加载到内存中了,就不需要再加载
而是将内存中已经存在的目标文件映射到其他.c文件的虚拟地址空间中,从而进行链接

优点:

所有程序共享一份副本,文件体积小
更新比较方便,更新时只需要替换原来的目标文件,而无需将所有的程序再重新链接一遍。

缺点:

因为把链接推迟到了程序运行时,所以每次执行程序都需要进行链接,所以性能会有一定损失

该阶段重定位时,涉及地址的改变

3、阶段六:执行(Execute)

程序如何执行?
1、hello.exe存储在硬盘中
如图所示:

2、从键盘中读取hello命令
如图所示:

3、将hello.exe从硬盘载入内存
如图所示:

4、从内存到显示器写这个输出的字符串
如图所示:

关于hello.i文件

# 1 "hello.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "hello.c"# 1 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 1 3
# 19 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3
# 1 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/_mingw.h" 1 3
# 32 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/_mingw.h" 3# 33 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/_mingw.h" 3
# 20 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 2 3# 1 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/include/stddef.h" 1 3 4
# 212 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/include/stddef.h" 3 4
typedef unsigned int size_t;
# 324 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/include/stddef.h" 3 4
typedef short unsigned int wchar_t;
# 353 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/include/stddef.h" 3 4
typedef short unsigned int wint_t;
# 27 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 2 3# 1 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/include/stdarg.h" 1 3 4
# 40 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 29 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 2 3
# 129 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3
typedef struct _iobuf
{char* _ptr;int _cnt;char* _base;int _flag;int _file;int _charbuf;int _bufsiz;char* _tmpfname;
} FILE;
# 154 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3
extern __attribute__ ((__dllimport__)) FILE _iob[];
# 169 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fopen (const char*, const char*);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) freopen (const char*, const char*, FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fflush (FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fclose (FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) remove (const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) rename (const char*, const char*);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) tmpfile (void);char* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) tmpnam (char*);char* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _tempnam (const char*, const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _rmtmp(void);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _unlink (const char*);char* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) tempnam (const char*, const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) rmtmp(void);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) unlink (const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) setvbuf (FILE*, char*, int, size_t);void __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) setbuf (FILE*, char*);
# 204 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3
extern int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __mingw_fprintf(FILE*, const char*, ...);
extern int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __mingw_printf(const char*, ...);
extern int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __mingw_sprintf(char*, const char*, ...);
extern int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __mingw_snprintf(char*, size_t, const char*, ...);
extern int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __mingw_vfprintf(FILE*, const char*, __gnuc_va_list);
extern int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __mingw_vprintf(const char*, __gnuc_va_list);
extern int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __mingw_vsprintf(char*, const char*, __gnuc_va_list);
extern int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __mingw_vsnprintf(char*, size_t, const char*, __gnuc_va_list);
# 293 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fprintf (FILE*, const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) printf (const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) sprintf (char*, const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vfprintf (FILE*, const char*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vprintf (const char*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vsprintf (char*, const char*, __gnuc_va_list);
# 308 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __msvcrt_fprintf(FILE*, const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __msvcrt_printf(const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __msvcrt_sprintf(char*, const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __msvcrt_vfprintf(FILE*, const char*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __msvcrt_vprintf(const char*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) __msvcrt_vsprintf(char*, const char*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _snprintf (char*, size_t, const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _vsnprintf (char*, size_t, const char*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _vscprintf (const char*, __gnuc_va_list);
# 331 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3
int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) snprintf (char *, size_t, const char *, ...);
int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vsnprintf (char *, size_t, const char *, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vscanf (const char * __restrict__, __gnuc_va_list);
int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vfscanf (FILE * __restrict__, const char * __restrict__,__gnuc_va_list);
int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vsscanf (const char * __restrict__,const char * __restrict__, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fscanf (FILE*, const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) scanf (const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) sscanf (const char*, const char*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fgetc (FILE*);char* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fgets (char*, int, FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fputc (int, FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fputs (const char*, FILE*);char* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) gets (char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) puts (const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) ungetc (int, FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _filbuf (FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _flsbuf (int, FILE*);extern __inline__ int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) getc (FILE* __F)
{return (--__F->_cnt >= 0)? (int) (unsigned char) *__F->_ptr++: _filbuf (__F);
}extern __inline__ int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) putc (int __c, FILE* __F)
{return (--__F->_cnt >= 0)? (int) (unsigned char) (*__F->_ptr++ = (char)__c): _flsbuf (__c, __F);
}extern __inline__ int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) getchar (void)
{return (--(&_iob[0])->_cnt >= 0)? (int) (unsigned char) *(&_iob[0])->_ptr++: _filbuf ((&_iob[0]));
}extern __inline__ int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) putchar(int __c)
{return (--(&_iob[1])->_cnt >= 0)? (int) (unsigned char) (*(&_iob[1])->_ptr++ = (char)__c): _flsbuf (__c, (&_iob[1]));}
# 412 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3size_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fread (void*, size_t, size_t, FILE*);size_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fwrite (const void*, size_t, size_t, FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fseek (FILE*, long, int);long __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) ftell (FILE*);void __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) rewind (FILE*);
# 455 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3
typedef long long fpos_t;int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fgetpos (FILE*, fpos_t*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fsetpos (FILE*, const fpos_t*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) feof (FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) ferror (FILE*);
# 480 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3void __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) clearerr (FILE*);void __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) perror (const char*);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _popen (const char*, const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _pclose (FILE*);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) popen (const char*, const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) pclose (FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _flushall (void);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fgetchar (void);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fputchar (int);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fdopen (int, const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fileno (FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fcloseall (void);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fsopen (const char*, const char*, int);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _getmaxstdio (void);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _setmaxstdio (int);
# 522 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fgetchar (void);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fputchar (int);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fdopen (int, const char*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fileno (FILE*);
# 534 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3
# 1 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/sys/types.h" 1 3
# 21 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/sys/types.h" 3
# 1 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/include/stddef.h" 1 3 4
# 150 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/include/stddef.h" 3 4
typedef int ptrdiff_t;
# 22 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/sys/types.h" 2 3typedef long __time32_t;typedef long long __time64_t;
# 45 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/sys/types.h" 3
typedef __time32_t time_t;typedef long _off_t;typedef _off_t off_t;typedef unsigned int _dev_t;typedef _dev_t dev_t;typedef short _ino_t;typedef _ino_t ino_t;typedef int _pid_t;typedef _pid_t pid_t;typedef unsigned short _mode_t;typedef _mode_t mode_t;typedef int _sigset_t;typedef _sigset_t sigset_t;typedef int _ssize_t;typedef _ssize_t ssize_t;typedef long long fpos64_t;typedef long long off64_t;typedef unsigned int useconds_t;
# 535 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 2 3
extern __inline__ FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fopen64 (const char* filename, const char* mode)
{return fopen (filename, mode);
}int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fseeko64 (FILE*, off64_t, int);extern __inline__ off64_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) ftello64 (FILE * stream)
{fpos_t pos;if (fgetpos(stream, &pos))return -1LL;elsereturn ((off64_t) pos);
}
# 563 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fwprintf (FILE*, const wchar_t*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) wprintf (const wchar_t*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _snwprintf (wchar_t*, size_t, const wchar_t*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vfwprintf (FILE*, const wchar_t*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vwprintf (const wchar_t*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _vsnwprintf (wchar_t*, size_t, const wchar_t*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _vscwprintf (const wchar_t*, __gnuc_va_list);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fwscanf (FILE*, const wchar_t*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) wscanf (const wchar_t*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) swscanf (const wchar_t*, const wchar_t*, ...);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fgetwc (FILE*);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fputwc (wchar_t, FILE*);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) ungetwc (wchar_t, FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) swprintf (wchar_t*, const wchar_t*, ...);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vswprintf (wchar_t*, const wchar_t*, __gnuc_va_list);wchar_t* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fgetws (wchar_t*, int, FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fputws (const wchar_t*, FILE*);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) getwc (FILE*);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) getwchar (void);wchar_t* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _getws (wchar_t*);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) putwc (wint_t, FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _putws (const wchar_t*);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) putwchar (wint_t);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wfdopen(int, const wchar_t *);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wfopen (const wchar_t*, const wchar_t*);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wfreopen (const wchar_t*, const wchar_t*, FILE*);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wfsopen (const wchar_t*, const wchar_t*, int);wchar_t* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wtmpnam (wchar_t*);wchar_t* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wtempnam (const wchar_t*, const wchar_t*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wrename (const wchar_t*, const wchar_t*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wremove (const wchar_t*);void __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wperror (const wchar_t*);FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _wpopen (const wchar_t*, const wchar_t*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...);
int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __gnuc_va_list arg);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vwscanf (const wchar_t * __restrict__, __gnuc_va_list);
int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vfwscanf (FILE * __restrict__,const wchar_t * __restrict__, __gnuc_va_list);
int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) vswscanf (const wchar_t * __restrict__,const wchar_t * __restrict__, __gnuc_va_list);
# 625 "e:\\mingw\\bin\\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h" 3FILE* __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) wpopen (const wchar_t*, const wchar_t*);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fgetwchar (void);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fputwchar (wint_t);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _getw (FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _putw (int, FILE*);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fgetwchar (void);wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) fputwchar (wint_t);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) getw (FILE*);int __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) putw (int, FILE*);
# 3 "hello.c" 2
int main(){printf("hello,world!\n");
}

c语言程序的生命周期(编写、预处理、编译、汇编、链接、执行)相关推荐

  1. 【C 语言】编译过程 分析 ( 预处理 | 编译 | 汇编 | 链接 | 宏定义 | 条件编译 | 编译器指示字 )

    相关文章链接 : 1.[嵌入式开发]C语言 指针数组 多维数组 2.[嵌入式开发]C语言 命令行参数 函数指针 gdb调试 3.[嵌入式开发]C语言 结构体相关 的 函数 指针 数组 4.[嵌入式开发 ...

  2. C语言 程序的翻译 预处理 编译 汇编 链接 #define详解

    1.程序的翻译环境和执行环境 执行环境:所在操作系统的平台 win10 win11 linux 翻译环境:MSVC gcc g++ 你的vs 2019 和2022 是集成开发环境把编辑器编译器全部给你 ...

  3. 从HelloWorld看iphone程序的生命周期

    做iphone开发首先第一件就是得知道iphone程序的生命周期,说白点就是当点击程序图标启动程序开始到退出程序整个使用运行过程中底下的代码都发生了什么,只有理解了这个才能游刃有余的掌握Iphone程 ...

  4. 移动应用程序开发_移动应用程序开发生命周期-从开发到应用程序商店的应用程序之旅

    移动应用程序开发 Lately, app stores have witnessed a meteoric rise in the number of apps available to them. ...

  5. 小程序全局生命周期和页面生命周期

    一.小程序的生命周期 1.我们可以把小程序的运行过程概括为生命周期 (1)小程序的启动,是生命周期的开始 (2)小程序的关闭,是生命周期的结束 (3)小程序的运行过程,就是所谓的生命周期 2.小程序的 ...

  6. 小程序生命周期_来,简单说说小程序的生命周期?

    简单说说小程序的生命周期? 在小程序中生命周期分为三大类 应用生命周期 页面生命周期 组件生命周期 应用生命周期 onLaunch(){ console.log('onLaunch监听小程序初始化') ...

  7. Android中级教程之--------Android应用程序的生命周期(一定要理解,面试会问的哦!)

    Android的应用程序的生命周期,我相信这在以后的Android面试一定是经常考的题目,所以大家一点要重视哦!下面我将图文双线程,希望对大家有一点帮助! 首先我们看一下Android应用程序的生命周 ...

  8. asp.net MVC 应用程序的生命周期

    首先我们知道http是一种无状态的请求,他的生命周期就是发出请求开始,到得到响应结束.那么MVC应用程序从发出请求到获得响应,都做了些什么呢? 本文我们会详细讨论MVC应用程序的生命周期和一个请求,从 ...

  9. 微信小程序 全局变量异步函数_微信小程序【生命周期】

    小程序分为应用.页面和组件三个部分,所以小程序的生命周期涉及以下 应用的生命周期 页面的生命周期 组件的声明周期 应用的生命周期对页面生命周期的影响 应用的生命周期 App() 函数用来注册一个小程序 ...

最新文章

  1. Redis、Kafka 和 Pulsar 消息队列对比
  2. jquery ajax下拉联动,jQuery Ajax MVC 下拉框联动
  3. e语言怎么连接mysql_大佬们E语言连接MYSQL输出中文乱码怎么破
  4. Linux6.5图形模式安装,CentOS 6.5弹性云服务器如何安装图形化界面
  5. 手写一切(updating...)
  6. 换行符在HTML中直接替换为br
  7. 台服DNF更换Mysql5.6(rpm包安装、二进制安装)
  8. vue源码解析-实现
  9. 数据大屏产品介绍PPT_精品推荐 | 产品介绍、公司宣传、解决方案 | 可编辑PPT(收藏)...
  10. 【转载】TinyXML2使用教程
  11. 网络游戏程序员新手入门 [转]
  12. 常见网站劫持案例及解析
  13. 23 种设计模式的通俗解释,虽然有点污,但是秒懂
  14. module 'gensim' has no attribute 'corpora'
  15. 快速fcm matlab,FCM的MATLAB实现
  16. 微信模板消息推送接口说明
  17. 关于linux系统密码策略的设置
  18. Windows应用、注册表
  19. 小甲鱼《零基础学习Python》课后笔记(二十三、二十四):递归——这帮小兔崽子和汉诺塔
  20. Python中 and 和 or 运算短路逻辑

热门文章

  1. iOS h264硬编码
  2. Linux查看文件内容的6种命令
  3. linux服务器学习笔记:linux忘记密码怎么办?
  4. elasticsearch_spring-data-elasticsearch 快速入门-Spring Boot+Elasticsearch
  5. python正则匹配中文_python 正则表达式匹配中文-阿里云开发者社区
  6. windows源码安装apache2 win安装apache 阿帕奇服务器
  7. Qt使用Qtxlsx读写xlsx文件
  8. webpack-internal:///./node_modules/vue/dist/vue.esm.js:629 [Vue warn]: Invalid prop: type check fail
  9. python定时重新初始化类_如何重新初始化类对象
  10. vue子组件mounted不执行_vue中父子组件传值,解决钩子函数mounted只运行一次的问题...