jwenjian / ghiblog

GitHub Issues Blog, powered by GitHub Issues and GitHub Actions

Home Page:https://1link.fun

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C 中的 inline 用法 | 菜鸟教程

jwenjian opened this issue · comments

Card C++ 中的 inline 用法 | 菜鸟教程 added the to the C家族 list in the 遇见 board at August 12, 2020 at 02:31PM

 

> 1、引入 inline 关键字的原因 在 c/c++ 中,为了解决一些频繁调用的小函数大量消耗栈空间(栈内存)的问题,特别的引入了 inline 修饰符,表示为内联函数。 栈空间就是指放置程序的局部数据(也就是函数内数据)的内存空间。 在系统下,栈空间是有限的,假如频繁大量的使用就会造成因栈空间不足而导致程序出错的问题,如,函数的死循环递归调用的最终结果就是导致栈内存空间枯竭。 下面我们来看一个例子: 实例 [mycode3 ..

 

---

 

View on Trello