C++头文件,预处理详解
一个例子
C++遵循先定义,后使用的原则。就拿函数的使用来举例吧。
我看过有些人喜欢这样写函数。
#include<iostream>
using namespace std; int add(int x, int y) //A
{
return x + y;
} int main()
{ int re = add(, ); //B system("pause");
return ;
}
但我更偏向下面这种。
#include<iostream>
using namespace std; int add(int x, int y); //A int main()
{ int re = add(, ); //B system("pause");
return ;
} int add(int x, int y) //C
{
return x + y;
}
C++的编译是以文件为单位,在某一个特定源文件中,则是从上至下,逐行解析的。
第一种风格中,A处的代码既是函数的定义(函数的实现),也充当了函数的声明。函数的定义是函数正真的实体,和逻辑实现。而声明则是告知编译器:我这个函数存在,我这个函数外观是什么样的(即 :返回值,参数类型和参数个数的相关信息)。
当编译器分析到B处代码时,编译器已经知道了函数存在,则允许出现这个函数的调用,知道了函数的外观,编译器还会分析函数调用时是否正确使用了,如参数个数,参数类型等。
这个过程中拆解开来就是:定义 , 声明 , 使用。显然第二种风格更好的阐述了这三部分。
那么问题来了?当项目过大后,实体(函数定义,类,结构体,变量定义等)会放在不同的文件中。但是编译器又是以文件为单位处理的,它在处理main.cpp时,完全不知道lib.cpp的任何信息。
那么,如果要在main.cpp中调用lib.cpp中定义的函数,就必须手动将lib.cpp中的函数头拷贝声明到main.cpp中。那如果在100个源文件中调用了lib.cpp中的函数,岂不是要拷贝100份?
这样累不说,又容易出错,还不利于后期维护。
于是预处理器说:“你只需将lib.cpp中的需要共享,在其他源文件中使用的实体单独声明到一个头文件lib.h中吧,别的源文件需要使用你的lib.cpp中的实体,只需要在他们的源文件中加上一行预处理指令:#include"lib.h" 就OK了,剩下事交给我”
于是一切变成了这样:
/*lib.cpp*/
#include"lib.h" int add(int x,int y)
{
return x+y;
}
/*lib.h*/
#ifndef _LIB_H__
#define _LIB_H__
int add(int x, int y);
#endif
/*main.cpp*/
#include<iostream>
#include"lib.h"
using namespace std;
int main()
{
int re = add(, );
cout << re << endl;
system("pause");
return ;
}
那么问题又来了:预处理器它到底是怎么帮你的呢,它做了什么手脚?
下面我们就来用VS2013看看预处理的结果。如何查看预处理结果--->点我
如果安装有g++编译器,则可以使用命令: g++ -E main.cpp -o main.i 来生成预处理文件
/*lib.i文件*/
int add(int x, int y); int add(int x,int y)
{
return x+y;
}
/*main.i
前面省略87260行,都是iostream头文件里面的东西,真多!
*/
int add(int x, int y);
using namespace std; int main()
{ int re = add(, );
cout << re << endl;
system("pause");
return ;
}
总结:
1、预处理器在.cpp中遇到#include<> 或者 #include " ", 都会将#include<> 或者 #include " "指令替换为他们包含的头文件中的内容,形成 .i文件。
这就是预处理器对头文件的处理结果。当然还要考虑到预处理器也是有逻辑的,比如防止重复包含#ifndef .......#define .......#endif
2、头文件只在预处理期起作用,预处理过后生成 .i 文件,此后头文件就没有作用了。
3、预处理指令 的 作用域 为 源文件作用域,也就是每 一条 预处理指令 只在它所在的 .cpp文件有效。
4、预处理不属于任何名称空间,名称空间“管不住”预处理指令。预处理指令不受C/C++的作用域规则,它是一种编译前期的机制。
5、用户将一个源文件( .c 或者 .cpp ) 提交给编译器后,首先执行的是该文件的预处理(处理源文件中的预处理指令),预处理后的结果为编译单元,这种编译单元才是编译器真正 工作的对象!程序员眼中看见的是 源文件(.c 或者 .cpp )和头文件, 而编译器眼中只有编译单元(预处理后形成的.i文件)。但是我 们口头上说的C/C++编译器包括预处理器。
如果你不理解C/C++的编译过程,请点 击我
以下通过几个特例说明需要注意事项.
防止头文件的重复包含
当项目大了后,编译单元之间的关系变得复杂,就很可能出现头文件重复包含的情况。虽然大多是情况下,重复包含头文件是没有问题的,但是这会使.i文件膨胀 。
C/C++遵循单定义,多声明的规则。声明多次没问题,但是不必要的声明除了在利于代码阅读外的目的下使用外,其他的要尽量避免。
一般采用以下方法。
#ifndef _XXX_H__
#define _XXX_H__ //被包含内容放中间 #endif
C++提供了#pragma once 预处理指令来达到上述效果,但是很多人习惯了C中的写法,也为了获得更大的兼容性。
普通全局变量
有时为了让一个源文件中的全局变量在多个源文件中的共享。
普通全局变量是有外部链接性(多个源文件共享一个实体),也就是它可以在所有的.cpp文件中共享使用。因为它将在所有的源文件中共享,所以必须保证不会在其他源文件的任何地方出现相同的链接性且相同名称的全局变量,正所谓一山不容二虎。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAusAAAG9CAIAAAAjpK8dAAAgAElEQVR4nO3d3Y8cVZrn8fpf9m41WmlvanZ6LtBerVojrUbavd8hpW3tSntR0G0aunE3nm7UncPSA2W7sKHdxkBhYxdpbGj8guvFVbaxC7+RZWOMy2NemrHVmAajXK32ir2IzMgTESciI08+cSLzPN+PECpnZWXGE+eJiF+eiMyc6gAAAEyaqboXAAAAYGgkGAAAMHlIMAAAYPKQYAAAwOQhwQAAgMlDggHg1dSQ6l5eAGOKvQOASgybVEg2AIbCXgCAjKojC4EGgInNHsBIPOQMogyALLZ2AEMbhzBR+wIAqBdbOIAhjG1iGM+lAlAdtm0ApUxKPpiU5QQwIrZqAEUmNxBM7pIDKIONGYBdMIf/YAoBYGIzBmAR3iE/vIoA5diGASSEfaQPuzpAFbZeAH1Kju5KygTCxqYLoEvVcZ3JGGDSsdEC0JVdTGoLBwLAFgtop/worrx8YHKxuQKqcfzuBLcS2s3p7Dmy2HSzLfg0+Y9WvBT5f9luTk81WoOevNVIP0D2lvwlTS9b73f9x2g3p82/sD24bUHbzempckufvlfB4qcfP/8JWo3CVZ7zpyUXOl5r0812ZgXVZIht1bLOpbUagpvXyBLDJcbDaqzEUP2avw9K7zkaTetuzngm9oMVSq3Lyp9vvAWzKgp6v92cltqhtRpTU9PT+buFwi0wfzMrt4dsNTJ3sjxkzgF9utkyls14wsRDmP+wLq69wDI7nuzDldpddXdAzfzjpGW1DHqSoh1sdOf+PVL75TE4kJXfUD0ceQdEek/6TZ888tgH1+nhx2Dgh1acYFJVpbs7vcEau1HLhpDcybIfrFAwx2wRwawND3MwccbO39DKvvYYdD9D/ESpTXK62c7bGSQ38d6/+puXuWMzHnW62Y5Ks7zEyu67CqY+rC9ObMue8yTmoideI1nHcdg5mLz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JBiII8HAD519En61OscVDkgwEEeCgR86+yT8anWOKxyQYCCOBAM/dPZJ+NXqHFc4IMFAHAkGfujsk/Cr1TmucECCgTgSDPzQ2SfhV6tzXOGABANxJBj4obNPwq9W57jCAQkG4kgw8ENnn4Rfrc5xhQMSDMSRYOCHzj4Jv1qd4woHJBiII8HAD519En61OscVDkgwEEeCgR86+yT8anWOKxyQYCCOBAM/dPZJ+NXqHFc4IMFAHAkGfujsk/Cr1TmucECCgTgSDPzQ2SfhV6tzXOGABANxJBj4obNPwq9W57jCAQkG4kgw8ENnn4Rfrc5xhQMSDMSRYOCHzj4Jv1qd4woHJBiII8HAD519En61OscVDkgwEEeCgR86+yT8anWOKxyQYCCOBAM/dPZJ+NXqHFc4IMFAHAkGfujsk/Cr1TmucECCgTgSDPzQ2SfhV6tzXOGABANxJBj4obNPVFSrc2gxlCnDiI8gu2CYaCQY+KGzT1RUq3NoMRSRJqHTYBo9FndoKpSjs09UVKtzaDEUEgzE0VTwRmefqKhW5JUQAibVHrQZTPQV/FB7jNNSrc7RRUniRxo6DYKdQFOhmNoOUVSw2jFGMdnGoM0QIcHAG7UdoqhgXh8jq4quoM1QUSymqZCluTd01cyOAKaK+oE2U45YDJ8094a6mjm6IFJpJ9BmalU39HQUspR3hcayp5LqXhz45qcB6DGFiMXwiZbQWrZN3QuFavkfdBpMD2IxPKMZOmoTTMR6SIMSNfaYn6eGB/7Hl0ZChzboUV18hxCjEm2GitTSTn6eFGOC0Tdprz/maxeH2tBgqM44tJPnZYBPjLgVqwDwqsrDKHyjl1CLehtvfLAiAGBS1X0khW91d9x4YXUAwMSr+8CKatXdX2OK9QIAACYPCQYAAEweEgwAAJg8JBgAADB5SDAAAGDykGAAAMDkIcEAAIDJQ4IBAACThwQDAAAmDwkGAABMHhIMAACYPCQYAAAwef4/RlKhZ+6LLQcAAAAASUVORK5CYII=" alt="" />
下面是错误的写法,编译不通过,提示错误:error : “int sum”: 重定义
相信如果你明白了头文件和预处理的机制,你就应该知道为什么是错误的了。
/*share.cpp*/
#include"share.h" int sum = ;
/*share.h*/
#ifndef _SHARE_H__
#define _SHARE_H__
int sum;
#endif
/*main.cpp*/
#include<iostream>
#include"share.h"
using namespace std; int main()
{
cout << sum << endl;
system("pause");
return ;
}
贴出代码说良心话。下面就是预处理后的结果。很明显的:全局变量sum的确重复定义了。在share.i 中 重复定义了2次,在main.i中又定义了一次,一共定义了3次!
/* share.i */
int sum; int sum = ;
/*main.i
省略iostream 中的代码
*/ int sum; using namespace std; int main()
{
cout << sum << endl;
system("pause");
return ;
}
要保证其他源文件能使用普通全局变量,又不会重定义,就要使用extern关键字来声明。extern用来声明。
改:
/*share.cpp*/
#include"share.h" int sum = ;
//extern int sum = 100; 也是OK的。
//这里 的extern是可选的,加上extern 的唯一目的是,暗示这个变量会被其他文件使用
/*share.h*/
#ifndef _SHARE_H__
#define _SHARE_H__
extern int sum;
#endif
/*main.cpp*/
#include<iostream>
#include"share.h"
using namespace std; int main()
{
cout << sum << endl;
system("pause");
return ;
}
全局static变量
static修饰全局变量的目的就是为了将外部链接性改为内部链接性(仅仅在定义它的文件中共享,对其他文件隐藏自己,定义的实体是源文件私有的)。
这样避免了对外部链接性空间的名称污染,其他源文件完全可以定义具有同名的外部链接的变量,当然也可以定义同名的内部链接变量。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA7IAAAH7CAIAAAB+KjQuAAAgAElEQVR4nO3d748cx53n+f5f9tnhsMD1g9477KN7dBgc0FzgDuiHt2jggDvgGqA8lk+usXftnTFmqrzGrFo/LJVaI+sHS1qJzhn9GFOlcTeZpCmTtChKRcoluqil7BqDwkiyLCP/gH2QvyIyI7OiuqIiv5X5foGYaVVVZ2VmhKM/9a3IyK0IAAAA6LytpncAAAAAaB6xGAAAACAWAwAAAMRiAAAAICIWAwAAABGxGAAAAIiIxQAAAEBELAYAAAAiYjEAAAAQEYsBAACAiFgMAAAARMRiAAAAICIWAwAAABGxGABQY2tJTe8vAJweQxgAYOn4S1wG0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QDQpM2Kj/baelwAWoxYDABNamt8bOtxAWgxYjEAAABALAYAAACIxQAAAEBELAYAAAAiYjEAAAAQEYsBAACAiFgMAAAARMRiAAAAICIWAwAAABGxGAAAAIiIxQC6ajo62h5MlAcmvYrbEY8H/V64+GUAgM1GLAbQSfPhQb83CvfO9Ler/h2E0+TFk95uf280T39eFItn4Z726/rj8b/dYKw9N+kZ3hcA4BGxGEAXzcK9Yvqsz7uTXhxkZ+FezcvCwJSq06eUR8YDNRmrsXs+PCAZA0ATiMUAOmg8yGJoxm52xCzcKxZ6zdtfEG1n4d5uMjdjOjrSisf1yRsAsCbEYgDdM+mpkbRuBsV8eFA9yyKfEVEM2XaxOM6+8+FBvzTLuZzaAQBrRiwG0DXjQX9bjcVaJI2iqDjhofhUsVo8Hx6o1+Slb1Ebi5UK8Xx4UAjB5UcAAOtHLAbQLbNwbzfoDSyrxUXjQb8Uo/Pas/aymlgcBtv5r5Rrw+X6MQBg/YjFALolDHphvubactXidELwwiXb6mLxLNzTcrA5FlMtBgDfiMUAOmh8qmqxEnaVgq7pCrnKWFzMxBFziwFACmIxgA46RbV4Ojra1uJvOqXYtDaFORZrcyf0LasvZiUKAGgEsRhABy1bLS5lYoUpQxticUUmjqLIsG4xE4sBwD9iMYAOWqZaPB8e9CszceEivFnptnlJFDYt9KZuU/1FMjEANIJYDKCDxoN+L1y0JvHu0XA26Zly6nigvmzx3T0AABuAWAwAAAAQiwEAAABiMQAAABARiwEAAICIWAwAAABExGIAAAAgIhYDAAAAEbEYAAAAiKLovwPvh4iJAfmwvAAAAABJRU5ErkJggg==" alt="" />
static修饰的全局变量 和 全局函数 都不要在对应模块的头文件中声明,因为static是为了隐藏在一个源文件中,而放在头文件中则是为了方便其他源文件使用,这2者显然矛盾了。
下面我们尝试开发一个对int数组排序的库来说明问题。举一反三靠大家自己了。
/*sort.cpp*/ /*
我们使用了2个函数完成排序:1、swap用于交换2个值,bubble_sort则是排序的实现。显然我们只想对其他使用者提供 bubble_sort这一个函数接口,而对外隐藏swap函数。于是将swap修饰为static
*/ #include"sort.h"
static void swap(int &a, int&b); //static 函数仅仅在自己的源文件声明就够了,不要在头文件中声明。
//为什么 需要在自己的源文件中声明呢?假如将下面的 swap函数和bubble_sort函数定义的位置交换下,那么
//编译器在从上往下解析sort.cpp时,会先看见swap在bubble_sort中的调用,而编译器事先不知道swap的任何声明和外观信息。 static void swap(int &a, int&b)
{
int t = a;
a = b;
b = t;
} void bubble_sort(int arr[], int len)
{
for (int i = ; i < len - ; ++i)
{
for (int j = ; j < len - - i; ++j)
{
if (arr[j]>arr[j + ])
swap(arr[j], arr[j + ]);
}
} }
/*sort.h*/
#ifndef _SORT_H_
#define _SORT_H_
void bubble_sort(int arr[], int len); #endif
#include"sort.h"
#include<iostream> using namespace std; int main()
{
int arr[] = { , , -, , - }; bubble_sort(arr, ); for (size_t i = ; i < ; ++i)
{
cout << arr[i] << endl;
} system("pause");
return ;
}
全局const常量
全局const默认是具有内部链接性,就像使用了static修饰后一样。(C程序员朋友注意,和C++不同,const常量在C中依旧是外部链接性的)
/*test.cpp*/ const int foo = ; //等价于 static const int foo = 12;
由于const全局常量是内部链接性的,所以我们可以将 const定义放在头文件中,这样所有包含了这个头文件的源文件都有了自己的一组const 定义,由于const为文件内部链接性,所以不会有重定义错误。
/*one.cpp*/
#include"one.h"
/*one.h*/
#ifndef _ONE_H__
#define _ONE_H__
const int x = ;
const int y = ; #endif
#include"one.h" int main()
{
return ;
}
预处理后
/*one.i */ const int x = ;
const int y = ;
/*main.i*/
const int x = ;
const int y = ; int main()
{ return ;
}
你会觉得这样很不经济,如果这个头文件被包含100次,那岂不是在这100个源文件都定义了这组全局常量?而且全局常量的存活期又很长。当然是有解决办法的。那就是使用extern
改:
/*one.cpp*/
#include"one.h" extern const int x = ;
extern const int y = ;
/*one.h*/
#ifndef _ONE_H__
#define _ONE_H__
extern const int x;
extern const int y; #endif
#include"one.h" int main()
{ return ;
}
预处理后的文件
/*one.i*/
extern const int x;
extern const int y; extern const int x = ;
extern const int y = ;
/*main.i*/ extern const int x;
extern const int y; int main()
{ return ;
}
但是:在C++中,如果const常量只 和 #define宏那样使用,是不会占用内存的,而是加入编译器的符号常量表中,这就是C++的const常量折叠折叠现象。但有些操作会迫使const存储在内存中,比如对const常量取地址等。因此将const常量直接放在头文件也是OK的,大多数情况也会这样做。
因此,如果两个不同的文件中声明同名的const ,不取它的地址,也不把它定义成extern,那么理想的C++编译器不会为他分配内存,而只是简单的把它折叠到代码中。--《C++编程思想第一卷》
全局函数
C++类 calss 和 结构体struct 中的成员函数受 OOP封装规则限定。这里只谈全局函数:在自定义名称空间中的,以及在全局(::)名称空间中的函数。
全局函数默认都是有外部链接性的。因此,在一个源文件中定义的函数,其他源文件只要有声明,就可以使用。
也可以将全局函数使用static 修饰,使其在定义它的源文件中私有化。此时它和使用static 修饰了的全局变量一样,会隐藏外部链接中同名的全局函数,也不会引起重名错误。
注意:全局inline函数默认是内部链接性,这也就是inline函数为什么可以整体定义放在头文件中的原因了。这点和宏函数一样,宏也是仅仅在一个源文件中有效的。
头文件中放什么?
1、类的定义
2、结构的定义
3、enum的定义
4、内敛函数的定义 和声明。内敛函数整体都放在头文件中。这样包含它的每个源文件才知道怎样展开。
5、函数的声明
6、模板
7、#define 宏 和 const 常量(C++不建议使用宏:宏常量使用const替代,宏函数使用inline函数替代)
C++头文件,预处理详解的更多相关文章
- http头文件User-Agent详解【转载】
原文地址:http://blog.csdn.net/andybbc/article/details/50587359 http头文件User-Agent详解 什么是User-Agent User-Ag ...
- C语言之预处理详解
C语言之预处理详解 纲要: 预定义符号 #define #define定义标识符 #define定义宏 #define的替换规则 #与## 几点注意#undef 带副作用的宏参数 宏和函数的对比 命名 ...
- C++文件读写详解(ofstream,ifstream,fstream)
C++文件读写详解(ofstream,ifstream,fstream) 这里主要是讨论fstream的内容: #include <fstream> ofstream //文件写操作 内存 ...
- Scrapy框架——介绍、安装、命令行创建,启动、项目目录结构介绍、Spiders文件夹详解(包括去重规则)、Selectors解析页面、Items、pipelines(自定义pipeline)、下载中间件(Downloader Middleware)、爬虫中间件、信号
一 介绍 Scrapy一个开源和协作的框架,其最初是为了页面抓取 (更确切来说, 网络抓取 )所设计的,使用它可以以快速.简单.可扩展的方式从网站中提取所需的数据.但目前Scrapy的用途十分广泛,可 ...
- [转载]MAC、IP头、TCP头、UDP头帧格式、详解
原文地址:MAC.IP头.TCP头.UDP头帧格式.详解作者:iTudu 转自:http://zoufengfu168.blog.163.com/blog/static/546105520099133 ...
- 【Linux学习】Linux下用户组、文件权限详解
原文地址:http://www.cnblogs.com/123-/p/4189072.html Linux下用户组.文件权限详解 用户组 在linux中的每个用户必须属于一个组,不能独立于组外.在li ...
- 史上最全的maven pom.xml文件教程详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- Uploadify 上传文件插件详解
Uploadify 上传文件插件详解 Uploadify是JQuery的一个上传插件,实现的效果非常不错,带进度显示.不过官方提供的实例时php版本的,本文将详细介绍Uploadify在Aspnet中 ...
- 转载 Spring、Spring MVC、MyBatis整合文件配置详解
Spring.Spring MVC.MyBatis整合文件配置详解 使用SSM框架做了几个小项目了,感觉还不错是时候总结一下了.先总结一下SSM整合的文件配置.其实具体的用法最好还是看官方文档. ...
- Spring MVC、MyBatis整合文件配置详解
Spring:http://spring.io/docs MyBatis:http://mybatis.github.io/mybatis-3/ Building a RESTful Web Serv ...
随机推荐
- ggplot2包--R可视化
1.ggplot2发展历程 ggplot2是Hadley在爱荷华州立大学博士期间的作品,也是他博士论文的主题之一,实际上ggplot2还有个前身ggplot,但后来废弃了,某种程度上这也是Hadley ...
- ural 1069. Prufer Code
1069. Prufer Code Time limit: 0.25 secondMemory limit: 8 MB A tree (i.e. a connected graph without c ...
- Start_Learning_Python 03 条件、循环
if循环 Python条件语句是通过一条或多条语句的执行结果(True或者False)来决定执行的代码块. 条件语句和循环语句可以有 else 子句,它在穷尽列表(以for循环)或条件变为 false ...
- BZOJ4382 : [POI2015]Podział naszyjnika
对于每种颜色,可以发现可以切的位置被分割成了若干段独立的区域. 给每个区域一个编号,将$m$种颜色的情况当成字符串来看,如果两个切口的字符串完全匹配,那么可以在这里切两刀. 可以构造hash函数,通过 ...
- Hadoop学习笔记(1)
Doug Cutting Lucene(索引引擎)---Nutch(搜索Data抓取)---Hadoop 1997:Lucene 2003:GFS 2004:NDFS\MapReduce\Nutch ...
- Codeforces Round #216 (Div. 2)A. Valera and Plates
#include <iostream> using namespace std; int main(){ int n, m , k; cin >> n >> m & ...
- ACM: Gym 100935F A Poet Computer - 字典树
Gym 100935F A Poet Computer Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d &am ...
- ffmpeg解码
解码流程 http://www.cnblogs.com/lidabo/p/4582391.html 例子 http://www.cnblogs.com/lidabo/p/4582393.html
- 纪念逝去的岁月——C/C++二分查找
代码 #include <stdio.h> int binarySearch(int iList[], int iNum, int iX, int * pPos) { if(NULL == ...
- 创建和使用动态链接库 (C++)
创建和使用动态链接库 (C++) 转载:http://msdn.microsoft.com/zh-cn/library/ms235636.aspx 此分步演练演示如何创建用于 C++ 应用的动态链接库 ...