PROTO and extern
来源:互联网 发布:粒子群算法应用于实际 编辑:程序博客网 时间:2024/04/30 07:51
我们看这段代码
1.#if HW
2.#define PROTO
3.#else
4.#define PROTO extern
5.#endif
PROTO BOOL bEventEnabled;
PROTO UALCONTROL AlControl;
PROTO UALEVENT AlEvent;
6.#if _PIC18
PROTO UINT16 u16CycleTime;
PROTO UINT16 u16OutShiftTime;
PROTO UINT16 u16InShiftTime;
PROTO UINT16 u16OutDelayTime;
PROTO UINT16 u16StartTime;
7.#endi
我们看到#define PROTO extern
也就是说PROTO等同于extern
接下来我们介绍下extern关键字
extern
1.引用同一文件中的变量,全局变量
2.引用另一个文件中的变量,将另一个文件全部包含进去可以引用另一个文件中的变量,但是这样做的结果就是,被包含的文件中的所有的变量和方法都可以被这个文件使用,这样就变得不安全,如果只是希望一个文件使用另一个文件中的某个变量还是使用extern关键字更好。
3.引用另一个文件中的函数。
阅读全文
1 0
- PROTO and extern
- proto
- Cap'n Proto, FlatBuffers, and SBE
- Cap'n Proto, FlatBuffers, and SBE
- static and global(extern)
- extern and static
- volatile and mutable and extern
- c++ extern const and static
- C++ and C Combination Compile Extern
- proto 运用
- proto存储
- extern
- extern
- extern
- extern
- extern
- extern
- extern
- ES性能调优权威指南(篇二)
- 稳压二极管
- 所历之感
- oracle 学习笔记
- Java Web从入门到精通01-Web开发基础-01Java Web应用开发概述
- PROTO and extern
- Excel玩转工资条
- NOIP2004虫食算
- 关于类型转换(2)
- 拓扑排序
- Eclipse mac 环境工程被锁
- The request sent by the client was syntactically incorrect.
- server socket
- vs怎么用断点调试?