Why Bother With the 'inline' Keyword in C++?

前端 未结 3 1361
你的背包
你的背包 2021-01-22 11:20

I\'ve just been researching the use and benefits/pitfalls of the C++ keyword inline on the Microsoft Website and I understand all of that.

My question is th

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-22 11:47

    Judging from the documentation in MSDN, I think it's a purely pragmatic thing, mostly for the benefit of C programs.

    Since inline is a valid identifier name in C, another keyword is needed in C.

    Personally, I would only consider using it if my source code could end up being shared between C and C++ programs (in Visual Studio, obviously).

提交回复
热议问题