#pragma once 和#ifndef的区别
来源:互联网 发布:淘宝韩版男装店 编辑:程序博客网 时间:2024/05/20 11:32
If your compiler supports "#pragma once",
It will ignore the rest of the header file when it finishes reading this line.
But if you use "#ifndef xxx", "#define xxx", "...", "#endif",
the compiler will go on parsing this file because it thinks that
there may be some more lines of code after "#endif",
it dare not to drop the rest of the file.
As you see,
if the compiler supports "#pragma once",
using "#pragma once" will accelerate the compiling process.
So people usually write header file like this:
#ifndef XXX
#define XXX
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER
...
...
#endif // XXX
It will ignore the rest of the header file when it finishes reading this line.
But if you use "#ifndef xxx", "#define xxx", "...", "#endif",
the compiler will go on parsing this file because it thinks that
there may be some more lines of code after "#endif",
it dare not to drop the rest of the file.
As you see,
if the compiler supports "#pragma once",
using "#pragma once" will accelerate the compiling process.
So people usually write header file like this:
#ifndef XXX
#define XXX
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER
...
...
#endif // XXX
- pragma once和#ifndef的区别
- #pragma once 和#ifndef的区别
- #pragma once 和 #ifndef的区别
- #pragma once 和 #ifndef 的区别
- #pragma once和#ifndef的区别
- #pragma once 和#ifndef的区别
- #ifndef和 #pragma once 区别
- #ifndef 和 #pragma once 区别
- 小议#pragma once 和 #ifndef #define #endif的区别
- #pragma once与 #ifndef的用法和区别
- #pragma once 和 #ifndef ... #define ... #endif 的区别【转载】
- #pragma once和#ifndef / #define / #endif的区别
- #pragma once 和 #ifndef ... #define ... #endif 的区别【转载】
- #pragma once和#ifndef,#define,#endif的区别
- #ifndef..#define..#endif和#pragma once的区别
- 头文件保护符和#pragma once #pragma once与 #ifndef的区别
- #pragma once和#ifndef
- #pragma once 和 #ifndef
- sysbase powerdesigner 过期 需要lic文件 解决方法
- 数字图像处理基本软件VC++实现基本处理功能 (二)
- Android UI Design 01 : 基本布局 Layout
- EAI技术纵览
- Mni2440 USB gadget 设备不能使用解决
- #pragma once 和#ifndef的区别
- HTTP的Hearder详解
- js常用正则表达式
- Xcode 4.1/4.2/4.3/4.4 + iOS 5.1.1免证书(iDP)开发+真机调试+生成IPA全攻略
- 我想把一个外部程序的Activity在当前程序的View中显示,但是结果是不行的程序意外退出,那位高手知道该作么做?
- WSGI.解析POST请求
- js 生成随机数
- 记录频道
- 如何判断网站是否被恶意镜像呢?