当前位置:网站首页>On inline function
On inline function
2022-06-30 20:35:00 【Rabbit cloud program】
What is an inline function
In Baidu Encyclopedia " In computer science , Inline function ( Sometimes called online functions or compile time expansion functions ) Is a programming language structure , It is used to suggest the compiler to extend some special functions inline ( Sometimes called online expansion )". The key word here is compiler , The behavior occurs in the compilation phase rather than the program running phase , So you used inline Syntax , It will increase the running time of your program, but it will not change the architecture and results of your program .
Motivation for designing inline functions
The inline function is C++ One of the enhanced features of . Inline extensions are used to eliminate the inherent time consumption caused by calling functions , Be able to execute functions quickly , This method also has spatial benefits for very small functions . Inline functions allow programmers to control the frequency of functions , Give the compiler favorable advice on whether the function is inline , Of course, if the function body is very large , The compiler also ignores the inline life of functions , I won't take your advice .
Syntax of inline functions
stay C++ The syntax keyword in the inline is "inline", Decorate... At the beginning of the function , You can say function inline declaration .
Comparison of inline functions and macros
Macros use text substitution , May not lead to expected consequences , Because of the priority of symbols , Calculate the parameters , Error in operation sequence .
Macro calls do not perform type checking , Function calls need to be checked
Macro compilation errors in compilation are difficult to find
边栏推荐
- Installation and use of securecrtportable
- BioVendor sRAGE Elisa试剂盒测试原理和注意事项
- Qt和其它GUI库的对比
- 数据库 OLAP、OLTP是什么?相同和不同?适用场景
- PostgreSQL heap堆表 存储引擎实现原理
- PHP require/include differences
- 项目经理是领导吗?可以批评指责成员吗?
- MySQL master-slave synchronization
- Summary of personal work of 21 groups in the first week of summer training
- originpro 2021 附安装教程
猜你喜欢
杰理之触摸按键识别流程【篇】
DEX文件解析 - method_ids解析
PHP require/include 区别
树基本概念
AVL balanced binary tree (I) - concept and C language implementation
Lumiprobe细胞生物学丨DiA,亲脂性示踪剂说明书
Halcon knowledge: check the measurement objects [1]
By analyzing more than 7million R & D needs, it is found that these eight programming languages are the most needed by the industry
昨晚 Spark Summit 重要功能发布全在这里(附超清视频)
Lumiprobe无铜点击化学解决方案
随机推荐
二叉查找树(一) - 概念与C语言实现
PHP文件上传小结(乱码,移动失败,权限,显示图片)
maya房子建模
Why must we move from Devops to bizdevops?
北京大学ACM Problems 1006:Biorhythms
SQL优化
Lambda 表达式原理分析学习(2022.06.23)
杰理之关于长按复位【篇】
Tensorflow2.4 implementation of repvgg
The newly born robot dog can walk by himself after rolling for an hour. The latest achievement of Wu Enda's first disciple
Meeting, onemeeting, OK!
杰理之检测灵敏度级别确定【篇】
Web host iptables firewall security script
Qt:qaxobject operation Excel
Network planning | [five transport layers and six application layers] knowledge points and examples
Halcon knowledge: check the measurement objects [1]
AVL balanced binary tree (I) - concept and C language implementation
1、生成对抗网络入门
QT qstringlist usage
MySQL master-slave synchronization